commit after merge with trunk

This commit is contained in:
askv
2010-09-09 20:26:00 -07:00
parent 84ecfe412a
commit aa77b69443
18 changed files with 394 additions and 301 deletions

View File

@@ -197,14 +197,17 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
if (img && fname!="") {
int err = 0;
if (saveFormat.format=="tif")
err = img->saveAsTIFF (fname, saveFormat.tiffBits);
err = img->saveAsTIFF (fname, saveFormat.tiffBits,saveFormat.tiffUncompressed);
else if (saveFormat.format=="png")
err = img->saveAsPNG (fname, saveFormat.pngCompression, saveFormat.pngBits);
else if (saveFormat.format=="jpg")
err = img->saveAsJPEG (fname, saveFormat.jpegQuality);
img->free ();
if (!err && saveFormat.saveParams)
processing->params.save (removeExtension(fname) + paramFileExtension);
// We keep the extension to avoid overwriting the profile when we have
// the same output filename with different extension
//processing->params.save (removeExtension(fname) + paramFileExtension);
processing->params.save (fname + paramFileExtension);
if (processing->thumbnail) {
processing->thumbnail->imageDeveloped ();
processing->thumbnail->imageRemovedFromQueue ();

View File

@@ -59,7 +59,7 @@ void BatchQueueEntryUpdater::process () {
if (stopped)
#undef THREAD_PRIORITY_NORMAL
thread = Glib::Thread::create(sigc::mem_fun(*this, &BatchQueueEntryUpdater::process_), (unsigned long int)0, true, true, Glib::THREAD_PRIORITY_NORMAL);
thread = Glib::Thread::create(sigc::mem_fun(*this, &BatchQueueEntryUpdater::process_), (unsigned long int)0, true, true, Glib::THREAD_PRIORITY_LOW);
}
void BatchQueueEntryUpdater::process_ () {

View File

@@ -7,7 +7,7 @@
* 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
@@ -110,13 +110,13 @@ EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), be
toolBarPanel->pack_end (*vsepcl, Gtk::PACK_SHRINK, 4);
toolBarPanel->pack_end (*iarea->imageArea->indClippedPanel, Gtk::PACK_SHRINK, 0);
toolBarPanel->pack_end (*vsepz, Gtk::PACK_SHRINK, 2);
afterBox = Gtk::manage (new Gtk::VBox ());
afterBox->pack_start (*iarea);
beforeAfterBox = Gtk::manage (new Gtk::HBox());
beforeAfterBox->pack_start (*afterBox);
editbox->pack_start (*toolBarPanel, Gtk::PACK_SHRINK);
editbox->pack_start (*beforeAfterBox);
@@ -171,7 +171,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), be
iops->pack_end (*iarea->imageArea->zoomPanel, Gtk::PACK_SHRINK, 1);
iops->pack_end (*vsepz2, Gtk::PACK_SHRINK, 2);
editbox->pack_start (*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_SHRINK, 4);
editbox->pack_start (*iops, Gtk::PACK_SHRINK, 4);
editbox->show_all ();
@@ -211,9 +211,9 @@ EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), be
show_all ();
// save as dialog
if (Glib::file_test (options.lastSaveAsPath, Glib::FILE_TEST_IS_DIR))
if (Glib::file_test (options.lastSaveAsPath, Glib::FILE_TEST_IS_DIR))
saveAsDialog = new SaveAsDialog (options.lastSaveAsPath);
else
else
saveAsDialog = new SaveAsDialog (Glib::get_user_special_dir (G_USER_DIRECTORY_PICTURES));
saveAsDialog->set_default_size (options.saveAsDialogWidth, options.saveAsDialogHeight);
@@ -228,7 +228,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), be
iarea->imageArea->setCropGUIListener (tpc->getCropGUIListener());
iarea->imageArea->setPointerMotionListener (navigator);
iarea->imageArea->setImageAreaToolListener (tpc);
// initialize components
info->set_active (options.showInfo);
tpc->readOptions ();
@@ -278,12 +278,12 @@ EditorPanel::~EditorPanel () {
delete green;
delete leftbox;
delete vboxright;
delete saveAsDialog;
}
void EditorPanel::on_realize () {
Gtk::VBox::on_realize ();
vboxright->set_size_request (options.toolPanelWidth, -1);
}
@@ -322,11 +322,11 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
if (openThm->getType()!=FT_Raw)
profilep->initProfile (options.defProfImg, ldprof, NULL);
else
profilep->initProfile (options.defProfRaw, ldprof, NULL);
profilep->initProfile (options.defProfRaw, ldprof, NULL);
openThm->addThumbnailListener (this);
info_toggled ();
beforeAfterToggled();
beforeAfterToggled();
@@ -339,7 +339,7 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
}
void EditorPanel::close () {
if (ipc)
{
saveProfile ();
@@ -349,7 +349,7 @@ void EditorPanel::close () {
if (ipc)
ipc->setPreviewImageListener (NULL);
if (beforeIpc)
beforeIpc->setPreviewImageListener (NULL);
@@ -361,9 +361,9 @@ void EditorPanel::close () {
delete iarea->imageArea->mainCropWindow;
iarea->imageArea->mainCropWindow = NULL;
rtengine::StagedImageProcessor::destroy (ipc);
rtengine::StagedImageProcessor::destroy (ipc);
ipc = NULL;
iarea->imageArea->setPreviewHandler (NULL);
iarea->imageArea->setImProcCoordinator (NULL);
navigator->previewWindow->setPreviewHandler (NULL);
@@ -373,17 +373,17 @@ void EditorPanel::close () {
openThm->decreaseRef ();
}
}
}
void EditorPanel::saveProfile () {
ProcParams params;
ipc->getParams (&params);
if (options.saveParamsFile)
params.save (openThm->getFileName() + paramFileExtension);
if (openThm && options.saveParamsCache)
if (openThm && options.saveParamsCache)
openThm->setProcParams (params, EDITOR);
}
@@ -397,7 +397,7 @@ Glib::ustring EditorPanel::getFileName () {
return openThm->getFileName ();
}
// TODO!!!
// TODO!!!
void EditorPanel::procParamsChanged (rtengine::procparams::ProcParams* params, rtengine::ProcEvent ev, Glib::ustring descr, ParamsEdited* paramsEdited) {
// if (ev!=EvPhotoLoaded)
@@ -417,7 +417,7 @@ int setprocstate (void* data) {
if (p->epih->destroyed) {
if (p->epih->pending == 1)
delete p->epih;
else
else
p->epih->pending--;
delete p;
gdk_threads_leave ();
@@ -457,7 +457,7 @@ void EditorPanel::refreshProcessingState (bool state) {
if (wlast)
statusBox->remove (*wlast);
}
if (state)
if (state)
statusBox->pack_end (*red, Gtk::PACK_SHRINK, 4);
else
statusBox->pack_end (*green, Gtk::PACK_SHRINK, 4);
@@ -486,7 +486,7 @@ int disperror (void* data) {
if (p->epih->destroyed) {
if (p->epih->pending == 1)
delete p->epih;
else
else
p->epih->pending--;
delete p;
gdk_threads_leave ();
@@ -515,13 +515,13 @@ void EditorPanel::info_toggled () {
const rtengine::ImageMetaData* idata = ipc->getInitialImage()->getMetaData();
if (idata && idata->hasExif())
infoString = Glib::ustring::compose ("%1 %2\nF/%3 %4 sec\n%5: %6\n%7: %8 mm\n",
infoString = Glib::ustring::compose ("%1 %2\nF/%3 %4 sec\n%5: %6\n%7: %8 mm\n",
Glib::ustring(idata->getMake()), Glib::ustring(idata->getModel()),
Glib::ustring(idata->apertureToString(idata->getFNumber())), Glib::ustring(idata->shutterToString(idata->getShutterSpeed())),
M("QINFO_ISO"), idata->getISOSpeed(),
M("QINFO_FOCALLENGTH"), idata->getFocalLen())
+ Glib::ustring::compose ("%1: %2", M("QINFO_LENS"), Glib::ustring(idata->getLens()));
else
else
infoString = M("QINFO_NOEXIF");
iarea->imageArea->setInfoText (infoString);
@@ -531,7 +531,7 @@ void EditorPanel::info_toggled () {
void EditorPanel::hideHistoryActivated () {
removeIfThere (hpanedl, leftbox, false);
if (hidehp->get_active())
if (hidehp->get_active())
hpanedl->pack1 (*leftbox, false, true);
options.showHistory = hidehp->get_active();
}
@@ -583,7 +583,7 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) {
iarea->imageArea->zoomPanel->zoom11Clicked();
return true;
case GDK_f:
case GDK_F:
case GDK_F:
iarea->imageArea->zoomPanel->zoomFitClicked();
return true;
}
@@ -613,8 +613,8 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) {
void EditorPanel::procParamsChanged (Thumbnail* thm, int whoChangedIt) {
if (whoChangedIt!=EDITOR)
tpc->profileChange (&openThm->getProcParams(), rtengine::EvProfileChangeNotification, M("PROGRESSDLG_PROFILECHANGEDINBROWSER"));
if (whoChangedIt!=EDITOR)
tpc->profileChange (&openThm->getProcParams(), rtengine::EvProfileChangeNotification, M("PROGRESSDLG_PROFILECHANGEDINBROWSER"));
}
bool EditorPanel::idle_saveImage (ProgressConnector<rtengine::IImage16*> *pc, Glib::ustring fname, SaveFormat sf, bool findNewNameIfNeeded){
@@ -719,7 +719,7 @@ void EditorPanel::saveAsPressed () {
SaveFormat sf = saveAsDialog->getFormat ();
if (getExtension (fname)!=sf.format)
fname = fname + "." + sf.format;
options.saveFormat = sf;
if (saveAsDialog->getImmediately ()) {
@@ -731,7 +731,7 @@ void EditorPanel::saveAsPressed () {
if (response==Gtk::RESPONSE_NO)
return;
}
// save image
// save image
rtengine::procparams::ProcParams pparams;
ipc->getParams (&pparams);
rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams);
@@ -901,12 +901,12 @@ void EditorPanel::beforeAfterToggled () {
removeIfThere (afterBox, afterLabel, false);
if (beforeIarea) {
if (beforeIpc)
if (beforeIpc)
beforeIpc->stopProcessing ();
iarea->setBeforeAfterViews (NULL, iarea);
delete beforeIarea;
beforeIarea = NULL;
if (beforeIpc)
if (beforeIpc)
beforeIpc->setPreviewImageListener (NULL);
delete beforePreviewHandler;
beforePreviewHandler = NULL;
@@ -944,7 +944,7 @@ void EditorPanel::beforeAfterToggled () {
iarea->setBeforeAfterViews (beforeIarea, iarea);
beforeIarea->setBeforeAfterViews (beforeIarea, iarea);
rtengine::procparams::ProcParams params;
if (history->getBeforeLineParams (params))
historyBeforeLineChanged (params);
@@ -952,7 +952,7 @@ void EditorPanel::beforeAfterToggled () {
}
void EditorPanel::histogramChanged (unsigned int* rh, unsigned int* gh, unsigned int* bh, unsigned int* lh, unsigned int* bcrgb, unsigned int* bcl) {
histogramPanel->histogramChanged (rh, gh, bh, lh);
histogramPanel->histogramChanged (rh, gh, bh, lh);
tpc->updateCurveBackgroundHistogram (bcrgb, bcl);
}

View File

@@ -90,6 +90,7 @@ void Options::setDefaults () {
maxCacheEntries = 10000;
thumbnailFormat = FT_Custom16;
thumbInterp = 1;
autoSuffix = false;
saveParamsFile = false;
saveParamsCache = true;
paramsLoadLocation = PLL_Cache;
@@ -198,6 +199,7 @@ if (keyFile.has_group ("Output")) {
if (keyFile.has_key ("Output", "Path")) savePathTemplate = keyFile.get_string ("Output", "Path");
if (keyFile.has_key ("Output", "PathTemplate")) savePathTemplate = keyFile.get_string ("Output", "PathTemplate");
if (keyFile.has_key ("Output", "PathFolder")) savePathFolder = keyFile.get_string ("Output", "PathFolder");
if (keyFile.has_key ("Output", "AutoSuffix")) autoSuffix = keyFile.get_boolean("Output", "AutoSuffix");
if (keyFile.has_key ("Output", "UsePathTemplate")) saveUsePathTemplate = keyFile.get_boolean("Output", "UsePathTemplate");
if (keyFile.has_key ("Output", "LastSaveAsPath")) lastSaveAsPath = keyFile.get_string ("Output", "LastSaveAsPath");
}
@@ -357,6 +359,7 @@ int Options::saveToFile (Glib::ustring fname) {
keyFile.set_boolean ("Output", "SaveProcParams", saveFormat.saveParams);
keyFile.set_string ("Output", "PathTemplate", savePathTemplate);
keyFile.set_string ("Output", "PathFolder", savePathFolder);
keyFile.set_boolean("Output", "AutoSuffix", autoSuffix);
keyFile.set_boolean("Output", "UsePathTemplate", saveUsePathTemplate);
keyFile.set_string ("Output", "LastSaveAsPath", lastSaveAsPath);

View File

@@ -95,6 +95,7 @@ class Options {
Glib::ustring language;
Glib::ustring theme;
static Glib::ustring cacheBaseDir;
bool autoSuffix;
bool saveParamsFile;
bool saveParamsCache;
PPLoadLocation paramsLoadLocation;

View File

@@ -1,219 +1,215 @@
/*
* 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 <previewwindow.h>
#include <guiutils.h>
#include <imagearea.h>
PreviewWindow::PreviewWindow () : previewHandler(NULL), mainCropWin(NULL),cCropMoving(NULL),cNormal(NULL), isMoving(false) {
rconn = signal_size_allocate().connect( sigc::mem_fun(*this, &PreviewWindow::on_resized) );
}
PreviewWindow::~PreviewWindow () {
if( cCropMoving )
delete cCropMoving;
if( cNormal )
delete cNormal;
}
void PreviewWindow::on_realize () {
Gtk::DrawingArea::on_realize ();
add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::SCROLL_MASK);
cCropMoving = new Gdk::Cursor (Gdk::FLEUR);
#ifdef _WIN32
cNormal = new Gdk::Cursor (Gdk::ARROW);
#else
cNormal = new Gdk::Cursor (Gdk::ARROW);
#endif
}
void PreviewWindow::getObservedFrameArea (int& x, int& y, int& w, int& h) {
if (mainCropWin) {
int cropX, cropY, cropW, cropH;
mainCropWin->getCropRectangle (cropX, cropY, cropW, cropH);
// translate it to screen coordinates
x = imgX + cropX*zoom;
y = imgY + cropY*zoom;
w = cropW * zoom;
h = cropH * zoom;
}
}
void PreviewWindow::updatePreviewImage () {
int W = get_width(), H = get_height();
Glib::RefPtr<Gdk::Window> wind = get_window();
if( ! wind )
return;
backBuffer = Gdk::Pixmap::create (wind, W, H, -1);
backBuffer->draw_rectangle (get_style()->get_base_gc(Gtk::STATE_NORMAL), true, 0, 0, W, H);
if (previewHandler) {
Glib::RefPtr<Gdk::Pixbuf> resPixbuf = previewHandler->getRoughImage (W, H, zoom);
if (resPixbuf) {
imgW = resPixbuf->get_width();
imgH = resPixbuf->get_height();
imgX = (W-imgW)/2;
imgY = (H-imgH)/2;
backBuffer->draw_pixbuf (get_style()->get_base_gc(Gtk::STATE_NORMAL), resPixbuf, 0, 0, imgX, imgY, -1, -1, Gdk::RGB_DITHER_NONE, 0, 0);
Cairo::RefPtr<Cairo::Context> cr = backBuffer->create_cairo_context();
if (previewHandler->getCropParams().enabled)
drawCrop (cr, imgX, imgY, imgW, imgH, 0, 0, zoom, previewHandler->getCropParams());
}
}
}
void PreviewWindow::setPreviewHandler (PreviewHandler* ph) {
previewHandler = ph;
if (previewHandler)
previewHandler->addPreviewImageListener (this);
}
void PreviewWindow::on_resized (Gtk::Allocation& req) {
updatePreviewImage ();
queue_draw ();
}
bool PreviewWindow::on_expose_event (GdkEventExpose* event) {
if (backBuffer) {
Glib::RefPtr<Gdk::Window> window = get_window();
int bufferW, bufferH;
backBuffer->get_size (bufferW, bufferH);
if (!mainCropWin) {
mainCropWin = imageArea->getMainCropWindow ();
if (mainCropWin)
mainCropWin->addCropWindowListener (this);
}
if (get_width()!=bufferW && get_height()!=bufferH)
updatePreviewImage ();
window->draw_drawable (get_style()->get_base_gc(Gtk::STATE_NORMAL), backBuffer, 0, 0, 0, 0, -1, -1);
if (mainCropWin) {
Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context();
int x, y, w, h;
getObservedFrameArea (x, y, w, h);
cr->set_source_rgb (1.0, 1.0, 1.0);
cr->set_line_width (3);
cr->rectangle (x-1.5, y-1.5, w+2, h+2);
cr->stroke ();
cr->set_source_rgb (1.0, 0.0, 0.0);
cr->set_line_width (1);
cr->rectangle (x-1.5, y-1.5, w+2, h+2);
cr->stroke ();
}
}
return true;
}
void PreviewWindow::previewImageChanged () {
updatePreviewImage ();
queue_draw ();
}
void PreviewWindow::setImageArea (ImageArea* ia) {
imageArea = ia;
mainCropWin = ia->getMainCropWindow ();
if (mainCropWin)
mainCropWin->addCropWindowListener (this);
}
void PreviewWindow::cropPositionChanged (CropWindow* w) {
queue_draw ();
}
void PreviewWindow::cropWindowSizeChanged (CropWindow* w) {
queue_draw ();
}
void PreviewWindow::cropZoomChanged (CropWindow* w) {
queue_draw ();
}
bool PreviewWindow::on_motion_notify_event (GdkEventMotion* event) {
if (!mainCropWin)
return true;
int x, y, w, h;
getObservedFrameArea (x, y, w, h);
bool inside = event->x > x-6 && event->x < x+w-1+6 && event->y > y-6 && event->y < y+h-1+6;
bool moreInside = event->x > x+6 && event->x < x+w-1-6 && event->y > y+6 && event->y < y+h-1-6;
if (isMoving)
mainCropWin->remoteMove ((event->x - press_x)/zoom, (event->y - press_y)/zoom);
else if (inside && !moreInside)
get_window()->set_cursor (*cCropMoving);
else
get_window()->set_cursor (*cNormal);
return true;
}
bool PreviewWindow::on_button_press_event (GdkEventButton* event) {
if (!mainCropWin)
return true;
int x, y, w, h;
getObservedFrameArea (x, y, w, h);
bool inside = event->x > x-6 && event->x < x+w-1+6 && event->y > y-6 && event->y < y+h-1+6;
bool moreInside = event->x > x+6 && event->x < x+w-1-6 && event->y > y+6 && event->y < y+h-1-6;
if (!isMoving) {
isMoving = true;
if (!inside || moreInside) {
mainCropWin->remoteMove ((event->x - (x+w/2))/zoom, (event->y - (y+h/2))/zoom);
press_x = x+w/2;
press_y = y+h/2;
}
else {
press_x = event->x;
press_y = event->y;
}
get_window()->set_cursor (*cCropMoving);
}
return true;
}
bool PreviewWindow::on_button_release_event (GdkEventButton* event) {
if (!mainCropWin)
return true;
if (isMoving) {
isMoving = false;
get_window()->set_cursor (*cNormal);
mainCropWin->remoteMoveReady ();
}
return true;
}
/*
* 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 <previewwindow.h>
#include <guiutils.h>
#include <imagearea.h>
PreviewWindow::PreviewWindow () : previewHandler(NULL), mainCropWin(NULL),cCropMoving(NULL),cNormal(NULL), isMoving(false) {
rconn = signal_size_allocate().connect( sigc::mem_fun(*this, &PreviewWindow::on_resized) );
}
PreviewWindow::~PreviewWindow () {
if( cCropMoving )
delete cCropMoving;
if( cNormal )
delete cNormal;
}
void PreviewWindow::on_realize () {
Gtk::DrawingArea::on_realize ();
add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::SCROLL_MASK);
cCropMoving = new Gdk::Cursor (Gdk::FLEUR);
cNormal = new Gdk::Cursor (Gdk::ARROW);
}
void PreviewWindow::getObservedFrameArea (int& x, int& y, int& w, int& h) {
if (mainCropWin) {
int cropX, cropY, cropW, cropH;
mainCropWin->getCropRectangle (cropX, cropY, cropW, cropH);
// translate it to screen coordinates
x = imgX + cropX*zoom;
y = imgY + cropY*zoom;
w = cropW * zoom;
h = cropH * zoom;
}
}
void PreviewWindow::updatePreviewImage () {
int W = get_width(), H = get_height();
Glib::RefPtr<Gdk::Window> wind = get_window();
if( ! wind )
return;
backBuffer = Gdk::Pixmap::create (wind, W, H, -1);
backBuffer->draw_rectangle (get_style()->get_base_gc(Gtk::STATE_NORMAL), true, 0, 0, W, H);
if (previewHandler) {
Glib::RefPtr<Gdk::Pixbuf> resPixbuf = previewHandler->getRoughImage (W, H, zoom);
if (resPixbuf) {
imgW = resPixbuf->get_width();
imgH = resPixbuf->get_height();
imgX = (W-imgW)/2;
imgY = (H-imgH)/2;
backBuffer->draw_pixbuf (get_style()->get_base_gc(Gtk::STATE_NORMAL), resPixbuf, 0, 0, imgX, imgY, -1, -1, Gdk::RGB_DITHER_NONE, 0, 0);
Cairo::RefPtr<Cairo::Context> cr = backBuffer->create_cairo_context();
if (previewHandler->getCropParams().enabled)
drawCrop (cr, imgX, imgY, imgW, imgH, 0, 0, zoom, previewHandler->getCropParams());
}
}
}
void PreviewWindow::setPreviewHandler (PreviewHandler* ph) {
previewHandler = ph;
if (previewHandler)
previewHandler->addPreviewImageListener (this);
}
void PreviewWindow::on_resized (Gtk::Allocation& req) {
updatePreviewImage ();
queue_draw ();
}
bool PreviewWindow::on_expose_event (GdkEventExpose* event) {
if (backBuffer) {
Glib::RefPtr<Gdk::Window> window = get_window();
int bufferW, bufferH;
backBuffer->get_size (bufferW, bufferH);
if (!mainCropWin) {
mainCropWin = imageArea->getMainCropWindow ();
if (mainCropWin)
mainCropWin->addCropWindowListener (this);
}
if (get_width()!=bufferW && get_height()!=bufferH)
updatePreviewImage ();
window->draw_drawable (get_style()->get_base_gc(Gtk::STATE_NORMAL), backBuffer, 0, 0, 0, 0, -1, -1);
if (mainCropWin) {
Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context();
int x, y, w, h;
getObservedFrameArea (x, y, w, h);
cr->set_source_rgb (1.0, 1.0, 1.0);
cr->set_line_width (3);
cr->rectangle (x-1.5, y-1.5, w+2, h+2);
cr->stroke ();
cr->set_source_rgb (1.0, 0.0, 0.0);
cr->set_line_width (1);
cr->rectangle (x-1.5, y-1.5, w+2, h+2);
cr->stroke ();
}
}
return true;
}
void PreviewWindow::previewImageChanged () {
updatePreviewImage ();
queue_draw ();
}
void PreviewWindow::setImageArea (ImageArea* ia) {
imageArea = ia;
mainCropWin = ia->getMainCropWindow ();
if (mainCropWin)
mainCropWin->addCropWindowListener (this);
}
void PreviewWindow::cropPositionChanged (CropWindow* w) {
queue_draw ();
}
void PreviewWindow::cropWindowSizeChanged (CropWindow* w) {
queue_draw ();
}
void PreviewWindow::cropZoomChanged (CropWindow* w) {
queue_draw ();
}
bool PreviewWindow::on_motion_notify_event (GdkEventMotion* event) {
if (!mainCropWin)
return true;
int x, y, w, h;
getObservedFrameArea (x, y, w, h);
bool inside = event->x > x-6 && event->x < x+w-1+6 && event->y > y-6 && event->y < y+h-1+6;
bool moreInside = event->x > x+6 && event->x < x+w-1-6 && event->y > y+6 && event->y < y+h-1-6;
if (isMoving)
mainCropWin->remoteMove ((event->x - press_x)/zoom, (event->y - press_y)/zoom);
else if (inside && !moreInside)
get_window()->set_cursor (*cCropMoving);
else
get_window()->set_cursor (*cNormal);
return true;
}
bool PreviewWindow::on_button_press_event (GdkEventButton* event) {
if (!mainCropWin)
return true;
int x, y, w, h;
getObservedFrameArea (x, y, w, h);
bool inside = event->x > x-6 && event->x < x+w-1+6 && event->y > y-6 && event->y < y+h-1+6;
bool moreInside = event->x > x+6 && event->x < x+w-1-6 && event->y > y+6 && event->y < y+h-1-6;
if (!isMoving) {
isMoving = true;
if (!inside || moreInside) {
mainCropWin->remoteMove ((event->x - (x+w/2))/zoom, (event->y - (y+h/2))/zoom);
press_x = x+w/2;
press_y = y+h/2;
}
else {
press_x = event->x;
press_y = event->y;
}
get_window()->set_cursor (*cCropMoving);
}
return true;
}
bool PreviewWindow::on_button_release_event (GdkEventButton* event) {
if (!mainCropWin)
return true;
if (isMoving) {
isMoving = false;
get_window()->set_cursor (*cNormal);
mainCropWin->remoteMoveReady ();
}
return true;
}

View File

@@ -22,6 +22,8 @@
extern Options options;
SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) {
set_title(M("GENERAL_SAVE"));
Gtk::VBox* vbox = get_vbox ();
fchooser = new Gtk::FileChooserWidget (Gtk::FILE_CHOOSER_ACTION_SAVE);
@@ -41,6 +43,16 @@ SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) {
Gtk::HSeparator* hsep1 = new Gtk::HSeparator ();
vbox->pack_start (*hsep1, Gtk::PACK_SHRINK, 2);
// Unique filename option
// ~~~~~~~~~~~~~~~~~~~~~~
autoSuffix = new Gtk::CheckButton (M("SAVEDLG_AUTOSUFFIX"));
autoSuffix->set_active(options.autoSuffix);
vbox->pack_start (*autoSuffix, Gtk::PACK_SHRINK, 4);
Gtk::HSeparator* hsep2 = new Gtk::HSeparator ();
vbox->pack_start (*hsep2, Gtk::PACK_SHRINK, 2);
// Output Options
// ~~~~~~~~~~~~~~
formatOpts = new SaveFormatPanel ();
@@ -49,8 +61,8 @@ SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) {
vbox->pack_start (*formatOpts, Gtk::PACK_SHRINK, 4);
Gtk::HSeparator* hsep2 = new Gtk::HSeparator ();
vbox->pack_start (*hsep2, Gtk::PACK_SHRINK, 2);
Gtk::HSeparator* hsep3 = new Gtk::HSeparator ();
vbox->pack_start (*hsep3, Gtk::PACK_SHRINK, 2);
// queue/immediate
// ~~~~~~~~~~~~~
@@ -83,6 +95,11 @@ SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) {
show_all_children ();
}
bool SaveAsDialog::getAutoSuffix () {
return autoSuffix->get_active();
}
bool SaveAsDialog::getImmediately () {
return immediately->get_active ();

View File

@@ -28,6 +28,7 @@ class SaveAsDialog : public Gtk::Dialog, public FormatChangeListener {
protected:
Gtk::FileChooserWidget* fchooser;
Gtk::CheckButton* autoSuffix;
SaveFormatPanel* formatOpts;
Glib::ustring fname;
Gtk::FileFilter filter_jpg;
@@ -43,6 +44,7 @@ class SaveAsDialog : public Gtk::Dialog, public FormatChangeListener {
Glib::ustring getFileName ();
Glib::ustring getDirectory ();
SaveFormat getFormat ();
bool getAutoSuffix ();
bool getImmediately ();
bool getToHeadOfQueue ();
bool getToTailOfQueue ();

View File

@@ -401,7 +401,7 @@ bool ThumbBrowserBase::Internal::on_expose_event(GdkEventExpose* event) {
dirty = false;
Glib::RefPtr<Gdk::Window> window = get_window();
Glib::RefPtr<Gdk::Window> window = get_window();
int w = get_width();
int h = get_height();
@@ -411,14 +411,14 @@ bool ThumbBrowserBase::Internal::on_expose_event(GdkEventExpose* event) {
Glib::RefPtr<Pango::Context> context = get_pango_context ();
context->set_font_description (get_style()->get_font());
for (int i=0; i<parent->fd.size(); i++) {
if (!parent->fd[i]->drawable || !parent->fd[i]->insideWindow (0, 0, w, h))
if (!parent->fd[i]->drawable || !parent->fd[i]->insideWindow (0, 0, w, h))
parent->fd[i]->updatepriority = false;
else {
parent->fd[i]->updatepriority = true;
parent->fd[i]->draw ();
}
}
return true;
}

View File

@@ -344,8 +344,8 @@ void ThumbBrowserEntryBase::draw () {
Glib::RefPtr<Gdk::GC> gc_ = Gdk::GC::create (w->get_window());
Gdk::Color textn = w->get_style()->get_text(Gtk::STATE_NORMAL);
Gdk::Color texts = w->get_style()->get_text(Gtk::STATE_SELECTED);
// Gdk::Color textn = w->get_style()->get_text(Gtk::STATE_NORMAL);
// Gdk::Color texts = w->get_style()->get_text(Gtk::STATE_SELECTED);
Gdk::Color bgn = w->get_style()->get_bg(Gtk::STATE_NORMAL);
Gdk::Color bgs = w->get_style()->get_bg(Gtk::STATE_SELECTED);