Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions src/JPEGView/Config/KeyMap-README.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
content: "toggle show file and EXIF info box in top, left corner"
}

.IDM_SHOW_FILEINFO_HISTOGRAM:before {
content: "toggle show histogram and details in EXIF info box in top, left corner"
}

.IDM_SHOW_FILENAME:before {
content: "toggle show file name on top of screen"
}
Expand Down Expand Up @@ -336,6 +340,14 @@
content: "edit user configuration"
}

.IDM_EDIT_GLOBAL_KEYMAP:before {
content: "edit global keymap"
}

.IDM_EDIT_USER_KEYMAP:before {
content: "edit user keymap"
}

.IDM_BACKUP_PARAMDB:before {
content: "backup parameter DB"
}
Expand Down Expand Up @@ -489,7 +501,7 @@ <h1>
<ul>
<li>F1 for help</li>
<li>Alt+F4 for exit</li>
<li>0..9 for slide show</li>
<li>0..9 with Shift/Ctrl for slide show</li>
</ul>

<h1>
Expand Down Expand Up @@ -728,6 +740,12 @@ <h1>
</td>
</tr>

<tr><td>IDM_SHOW_FILEINFO_HISTOGRAM</td>
<td>
<span class="IDM_SHOW_FILEINFO_HISTOGRAM" />
</td>
</tr>

<tr><td>IDM_SHOW_FILENAME</td>
<td>
<span class="IDM_SHOW_FILENAME" />
Expand Down Expand Up @@ -1082,6 +1100,18 @@ <h1>
</td>
</tr>

<tr><td>IDM_EDIT_GLOBAL_KEYMAP</td>
<td>
<span class="IDM_EDIT_GLOBAL_KEYMAP" />
</td>
</tr>

<tr><td>IDM_EDIT_USER_KEYMAP</td>
<td>
<span class="IDM_EDIT_USER_KEYMAP" />
</td>
</tr>

<tr><td>IDM_BACKUP_PARAMDB</td>
<td>
<span class="IDM_BACKUP_PARAMDB" />
Expand Down Expand Up @@ -1255,4 +1285,4 @@ <h1>
<span class="IDM_CONTEXT_MENU" />
</td>
</tr>
</html>
</html>
3 changes: 3 additions & 0 deletions src/JPEGView/Config/symbols.km
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#define IDM_SET_WALLPAPER_ORIG 2770
#define IDM_SET_WALLPAPER_DISPLAY 2774
#define IDM_SHOW_FILEINFO 2800
#define IDM_SHOW_FILEINFO_HISTOGRAM 2830
#define IDM_SHOW_FILENAME 3000
#define IDM_SHOW_NAVPANEL 3100
#define IDM_NEXT 4000
Expand Down Expand Up @@ -89,6 +90,8 @@
#define IDM_AUTO_ZOOM_FILL_NO_ZOOM 12510
#define IDM_AUTO_ZOOM_FIT 12520
#define IDM_AUTO_ZOOM_FILL 12530
#define IDM_EDIT_GLOBAL_KEYMAP 12590
#define IDM_EDIT_USER_KEYMAP 12695
#define IDM_EDIT_GLOBAL_CONFIG 12600
#define IDM_EDIT_USER_CONFIG 12610
#define IDM_BACKUP_PARAMDB 12620
Expand Down
44 changes: 30 additions & 14 deletions src/JPEGView/EXIFDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static CRect InflateRect(const CRect& rect, float fAmount) {
return r;
}

CEXIFDisplay::CEXIFDisplay(HWND hWnd, INotifiyMouseCapture* pNotifyMouseCapture) : CPanel(hWnd, pNotifyMouseCapture, true, true) {
CEXIFDisplay::CEXIFDisplay(HWND hWnd, INotifiyMouseCapture* pNotifyMouseCapture) : CPanel(hWnd, pNotifyMouseCapture, false, true) {
m_bShowHistogram = false;
m_nGap = (int)(m_fDPIScale * 10);
m_nTab1 = 0;
Expand All @@ -44,8 +44,10 @@ CEXIFDisplay::CEXIFDisplay(HWND hWnd, INotifiyMouseCapture* pNotifyMouseCapture)
m_nNoHistogramSize = CSize(0, 0);
m_pHistogram = NULL;

AddUserPaintButton(ID_btnShowHideHistogram, &ShowHistogramTooltip, &PaintShowHistogramBtn, NULL, this, this);
AddUserPaintButton(ID_btnClose, CNLS::GetString(_T("Close")), &PaintCloseBtn, NULL, this, this);
LPCTSTR nullTooltip = NULL; // Needed because passing NULL directly to overloaded function makes it ambiguous

AddUserPaintButton(ID_btnShowHideHistogram, nullTooltip, &PaintShowHistogramBtn, NULL, this, this);
AddUserPaintButton(ID_btnClose, nullTooltip, &PaintCloseBtn, NULL, this, this);
CURLCtrl* pLinkLocation = AddURL(ID_urlLocation, _T(""), _T(""), false);
pLinkLocation->SetShow(false, false);
}
Expand Down Expand Up @@ -105,8 +107,8 @@ void CEXIFDisplay::SetGPSLocation(LPCTSTR sLocation, LPCTSTR sURL) {
pLinkLocation->SetShow(true, false);
}

void CEXIFDisplay::AddLine(LPCTSTR sDescription, LPCTSTR sValue, bool valueIsURL) {
m_lines.push_back(TextLine(CopyStrAlloc(sDescription), CopyStrAlloc(sValue), valueIsURL));
void CEXIFDisplay::AddLine(LPCTSTR sDescription, LPCTSTR sValue, bool valueIsURL, bool sameLine) {
m_lines.push_back(TextLine(CopyStrAlloc(sDescription), CopyStrAlloc(sValue), valueIsURL, sameLine && !m_bShowHistogram));
}

void CEXIFDisplay::AddLine(LPCTSTR sDescription, double dValue, int nDigits) {
Expand Down Expand Up @@ -171,7 +173,8 @@ CRect CEXIFDisplay::PanelRect() {
m_nPrefixLength = 0;
m_nTitleWidth = 0;
int nTitleLength = 0;
int nMaxLength1 = 0, nMaxLength2 = 0;
int nMaxLengthColumn1 = 0, nMaxLengthColumn2 = 0;
int nLastLineLengthColumn2 = 0;
CSize size;
if (m_sPrefix != NULL) {
::GetTextExtentPoint32(dc, m_sPrefix, (int)_tcslen(m_sPrefix), &size);
Expand Down Expand Up @@ -201,33 +204,40 @@ CRect CEXIFDisplay::PanelRect() {

int nLen1 = 0, nLen2 = 0;
std::list<TextLine>::iterator iter;
int nLineCountExcludingSameLineLines = 0;
for (iter = m_lines.begin( ); iter != m_lines.end( ); iter++ ) {
if (iter->Desc != NULL) {
if (!(iter->SameLine)) {
nLineCountExcludingSameLineLines += 1;
}
if (iter->Desc != NULL && m_bShowHistogram) {
::GetTextExtentPoint32(dc, iter->Desc, (int)_tcslen(iter->Desc), &size);
m_nLineHeight = max(m_nLineHeight, size.cy);
nMaxLength1 = max(nMaxLength1, size.cx);
nMaxLengthColumn1 = max(nMaxLengthColumn1, size.cx);
}
nLen2 = nLen1;
nLen1 = 0;
if (iter->Value != NULL) {
::GetTextExtentPoint32(dc, iter->Value, (int)_tcslen(iter->Value), &size);
m_nLineHeight = max(m_nLineHeight, size.cy);
nMaxLength2 = max(nMaxLength2, size.cx);
nMaxLengthColumn2 = max(nMaxLengthColumn2, size.cx);
nLastLineLengthColumn2 = size.cx;
nLen1 = size.cx;
}
}

int nButtonWidth = (int)(m_fDPIScale * BUTTON_SIZE);
bool bNeedsExpansionForButton = (nMaxLength2 - max(nLen1, nLen2)) < nButtonWidth + m_nGap;
int nNeededWidthNoBorders = max(nTitleLength, nMaxLength1 + nMaxLength2 + m_nGap) + (bNeedsExpansionForButton ? m_nGap + nButtonWidth : 0);
int columnGap = m_bShowHistogram ? m_nGap : 0;
int nNeededWidthNoBorders = max(max(nTitleLength, nMaxLengthColumn1 + nMaxLengthColumn2 + m_nGap), nMaxLengthColumn1 + columnGap + nLastLineLengthColumn2 + m_nGap/2 + nButtonWidth);
int nExpansionX = 0, nExpansionY = 0;
if (m_bShowHistogram) {
nExpansionX = max(0, HelpersGUI::ScaleToScreen(256) - nNeededWidthNoBorders);
nExpansionY = HelpersGUI::ScaleToScreen(HISTOGRAM_HEIGHT) + m_nGap;
}



m_size = CSize(nNeededWidthNoBorders + m_nGap*2 + nExpansionX,
m_nTitleHeight + (int)m_lines.size()*m_nLineHeight + m_nGap * 2 + nExpansionY);
m_nTitleHeight + nLineCountExcludingSameLineLines*m_nLineHeight + m_nGap * 2 + nExpansionY);

if (m_sComment != NULL) {
CRect rectComment(0, 0, m_size.cx - m_nGap*2, HelpersGUI::ScaleToScreen(200));
Expand All @@ -237,7 +247,10 @@ CRect CEXIFDisplay::PanelRect() {
}

m_nNoHistogramSize = CSize(m_size.cx - nExpansionX, m_size.cy - nExpansionY);
m_nTab1 = nMaxLength1 + m_nGap;
m_nTab1 = nMaxLengthColumn1 + m_nGap;
if (!m_bShowHistogram) {
m_nTab1 = 0;
}
}
return CRect(m_pos, m_size);
}
Expand Down Expand Up @@ -289,7 +302,10 @@ void CEXIFDisplay::OnPaint(CDC & dc, const CPoint& offset) {

std::list<TextLine>::iterator iter;
for (iter = m_lines.begin( ); iter != m_lines.end( ); iter++ ) {
if (iter->Desc != NULL) {
if (iter->SameLine) {
nRunningY -= m_nLineHeight;
}
if (iter->Desc != NULL && m_bShowHistogram) {
::TextOut(dc, nX + m_nGap, nRunningY, iter->Desc, (int)_tcslen(iter->Desc));
}
if (iter->Value != NULL) {
Expand Down
6 changes: 4 additions & 2 deletions src/JPEGView/EXIFDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CEXIFDisplay : public CPanel
void AddTitle(LPCTSTR sTitle);
void SetComment(LPCTSTR sComment);
void SetGPSLocation(LPCTSTR sLocation, LPCTSTR sURL);
void AddLine(LPCTSTR sDescription, LPCTSTR sValue, bool valueIsURL = false);
void AddLine(LPCTSTR sDescription, LPCTSTR sValue, bool valueIsURL = false, bool sameLine = false);
void AddLine(LPCTSTR sDescription, double dValue, int nDigits);
void AddLine(LPCTSTR sDescription, int nValue);
void AddLine(LPCTSTR sDescription, const SYSTEMTIME &time); // time is in local time
Expand All @@ -49,15 +49,17 @@ class CEXIFDisplay : public CPanel
private:

struct TextLine {
TextLine(LPCTSTR desc, LPCTSTR value, bool valueIsURL = false) {
TextLine(LPCTSTR desc, LPCTSTR value, bool valueIsURL = false, bool sameLine = false) {
Desc = desc;
Value = value;
ValueIsURL = valueIsURL;
SameLine = sameLine;
}

LPCTSTR Desc;
LPCTSTR Value;
bool ValueIsURL;
bool SameLine;
};

bool m_bShowHistogram;
Expand Down
Loading