Improvements for Detail Window, see Issue 2376 comment #4 for details

This commit is contained in:
Ingo
2014-05-12 00:45:40 +02:00
parent 79ca151cd2
commit 88bf64cafc
4 changed files with 36 additions and 8 deletions

View File

@@ -416,7 +416,13 @@ void CropWindow::buttonRelease (int button, int num, int bstate, int x, int y) {
bool needRedraw = false; bool needRedraw = false;
if (state==SCropWinResize) { if (state==SCropWinResize) {
setSize (press_x + x - action_x, press_y + y - action_y); int newWidth = press_x + x - action_x;
int newHeight = press_y + y - action_y;
setSize(newWidth, newHeight);
if (decorated) {
options.detailWindowWidth = newWidth;
options.detailWindowHeight = newHeight;
}
state = SNormal; state = SNormal;
for (std::list<CropWindowListener*>::iterator i=listeners.begin(); i!=listeners.end(); i++) for (std::list<CropWindowListener*>::iterator i=listeners.begin(); i!=listeners.end(); i++)
(*i)->cropWindowSizeChanged (this); (*i)->cropWindowSizeChanged (this);

View File

@@ -357,6 +357,14 @@ void ImageArea::addCropWindow () {
cw->setCropGUIListener (cropgl); cw->setCropGUIListener (cropgl);
cw->setPointerMotionListener (pmlistener); cw->setPointerMotionListener (pmlistener);
cw->setPointerMotionHListener (pmhlistener); cw->setPointerMotionHListener (pmhlistener);
int lastWidth = options.detailWindowWidth;
int lastHeight = options.detailWindowHeight;
if(!cropWins.empty()) {
CropWindow *lastCrop;
lastCrop = cropWins.front();
if(lastCrop)
lastCrop->getSize(lastWidth,lastHeight);
}
cropWins.push_front (cw); cropWins.push_front (cw);
// Position the new crop window in a checkerboard, or used the last position // Position the new crop window in a checkerboard, or used the last position
@@ -370,8 +378,13 @@ void ImageArea::addCropWindow () {
int col = K-1 - (N % (K*K)) % K; int col = K-1 - (N % (K*K)) % K;
int cropwidth, cropheight; int cropwidth, cropheight;
cropwidth = get_width()/K - hBorder; if(lastWidth == -1) {
cropheight = get_height()/K - vBorder; cropwidth = get_width()/K - hBorder;
cropheight = get_height()/K - vBorder;
} else {
cropwidth = lastWidth;
cropheight = lastHeight;
}
if (options.squareDetailWindow){ if (options.squareDetailWindow){
// force square CropWindow (this is faster as area is smaller) // force square CropWindow (this is faster as area is smaller)
@@ -396,7 +409,8 @@ void ImageArea::addCropWindow () {
cw->setCropPosition(x0+w/2-wc/2,y0+h/2-hc/2); cw->setCropPosition(x0+w/2-wc/2,y0+h/2-hc/2);
mainCropWindow->setObservedCropWin (cropWins.front()); mainCropWindow->setObservedCropWin (cropWins.front());
ipc->startProcessing(M_HIGHQUAL); if(cropWins.size()==1) // after first detail window we already have high quality
ipc->startProcessing(M_HIGHQUAL);
// queue_draw (); // queue_draw ();
} }

View File

@@ -258,7 +258,9 @@ void Options::setDefaults () {
adjusterDelay = 0; adjusterDelay = 0;
startupDir = STARTUPDIR_LAST; startupDir = STARTUPDIR_LAST;
startupPath = ""; startupPath = "";
useBundledProfiles = true; useBundledProfiles = true;
detailWindowWidth = -1;
detailWindowHeight = -1;
dirBrowserWidth = 260; dirBrowserWidth = 260;
dirBrowserHeight = 350; dirBrowserHeight = 350;
preferencesWidth = 800; preferencesWidth = 800;
@@ -702,7 +704,9 @@ if (keyFile.has_group ("GUI")) {
if (keyFile.has_key ("GUI", "Font")) font = keyFile.get_string ("GUI", "Font"); if (keyFile.has_key ("GUI", "Font")) font = keyFile.get_string ("GUI", "Font");
if (keyFile.has_key ("GUI", "WindowWidth")) windowWidth = keyFile.get_integer ("GUI", "WindowWidth"); if (keyFile.has_key ("GUI", "WindowWidth")) windowWidth = keyFile.get_integer ("GUI", "WindowWidth");
if (keyFile.has_key ("GUI", "WindowHeight")) windowHeight = keyFile.get_integer ("GUI", "WindowHeight"); if (keyFile.has_key ("GUI", "WindowHeight")) windowHeight = keyFile.get_integer ("GUI", "WindowHeight");
if (keyFile.has_key ("GUI", "WindowMaximized")) windowMaximized = keyFile.get_boolean ("GUI", "WindowMaximized"); if (keyFile.has_key ("GUI", "WindowMaximized")) windowMaximized = keyFile.get_boolean ("GUI", "WindowMaximized");
if (keyFile.has_key ("GUI", "DetailWindowWidth")) detailWindowWidth = keyFile.get_integer ("GUI", "DetailWindowWidth");
if (keyFile.has_key ("GUI", "DetailWindowHeight")) detailWindowHeight = keyFile.get_integer ("GUI", "DetailWindowHeight");
if (keyFile.has_key ("GUI", "DirBrowserWidth")) dirBrowserWidth = keyFile.get_integer ("GUI", "DirBrowserWidth"); if (keyFile.has_key ("GUI", "DirBrowserWidth")) dirBrowserWidth = keyFile.get_integer ("GUI", "DirBrowserWidth");
if (keyFile.has_key ("GUI", "DirBrowserHeight")) dirBrowserHeight = keyFile.get_integer ("GUI", "DirBrowserHeight"); if (keyFile.has_key ("GUI", "DirBrowserHeight")) dirBrowserHeight = keyFile.get_integer ("GUI", "DirBrowserHeight");
if (keyFile.has_key ("GUI", "PreferencesWidth")) preferencesWidth = keyFile.get_integer ("GUI", "PreferencesWidth"); if (keyFile.has_key ("GUI", "PreferencesWidth")) preferencesWidth = keyFile.get_integer ("GUI", "PreferencesWidth");
@@ -993,6 +997,8 @@ int Options::saveToFile (Glib::ustring fname) {
keyFile.set_integer ("GUI", "WindowWidth", windowWidth); keyFile.set_integer ("GUI", "WindowWidth", windowWidth);
keyFile.set_integer ("GUI", "WindowHeight", windowHeight); keyFile.set_integer ("GUI", "WindowHeight", windowHeight);
keyFile.set_boolean ("GUI", "WindowMaximized", windowMaximized); keyFile.set_boolean ("GUI", "WindowMaximized", windowMaximized);
keyFile.set_integer ("GUI", "DetailWindowWidth", detailWindowWidth);
keyFile.set_integer ("GUI", "DetailWindowHeight", detailWindowHeight);
keyFile.set_integer ("GUI", "DirBrowserWidth", dirBrowserWidth); keyFile.set_integer ("GUI", "DirBrowserWidth", dirBrowserWidth);
keyFile.set_integer ("GUI", "DirBrowserHeight", dirBrowserHeight); keyFile.set_integer ("GUI", "DirBrowserHeight", dirBrowserHeight);
keyFile.set_integer ("GUI", "PreferencesWidth", preferencesWidth); keyFile.set_integer ("GUI", "PreferencesWidth", preferencesWidth);
@@ -1278,7 +1284,7 @@ bool Options::load () {
} }
void Options::save () { void Options::save () {
if (options.multiUser==false) { if (options.multiUser==false) {
options.saveToFile (Glib::build_filename(argv0, "options")); options.saveToFile (Glib::build_filename(argv0, "options"));
} }

View File

@@ -113,7 +113,9 @@ class Options {
Glib::ustring font; Glib::ustring font;
int windowWidth; int windowWidth;
int windowHeight; int windowHeight;
bool windowMaximized; bool windowMaximized;
int detailWindowWidth;
int detailWindowHeight;
int dirBrowserWidth; int dirBrowserWidth;
int dirBrowserHeight; int dirBrowserHeight;
int preferencesWidth; int preferencesWidth;