[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : luke
Repository : xara
Revision : 1758
Date : Wed Sep 20 12:25:12 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/imjpeg.cpp
M /Trunk/XaraLX/Kernel/imjpeg.h
M /Trunk/XaraLX/Kernel/optsview.cpp
M /Trunk/XaraLX/wxOil/xrc/EN/prefsdlg-sizer.xrc
Port import JPGs at 96dpi code
Diff:
Index: Trunk/XaraLX/Kernel/imjpeg.h
===================================================================
--- Trunk/XaraLX/Kernel/imjpeg.h (revision 1757)
+++ Trunk/XaraLX/Kernel/imjpeg.h (revision 1758)
@@ -143,6 +143,9 @@
virtual BOOL ReadFromFile(OILBitmap* pOilBitmap);
+ static BOOL GetImportAt96dpi() { return m_fImportAt96dpi; }
+ static void SetImportAt96dpi( BOOL fImportAt96 ) { m_fImportAt96dpi = fImportAt96; }
+
protected:
BOOL DoFilter(CCFile* pInputFile, OILBitmap* pOilBitmap);
@@ -177,6 +180,7 @@
BOOL m_bOldReportErrors;
BOOL m_bOldThrowExceptions;
UINT32 m_uStartOffset;
+ static BOOL m_fImportAt96dpi;
// the IJG control structure
struct libJPEG::jpeg_decompress_struct m_cinfo;
Index: Trunk/XaraLX/Kernel/optsview.cpp
===================================================================
--- Trunk/XaraLX/Kernel/optsview.cpp (revision 1757)
+++ Trunk/XaraLX/Kernel/optsview.cpp (revision 1758)
@@ -119,6 +119,7 @@
#include "palman.h"
#include "coldlog.h"
#include "bmpcomp.h" // for BitmapList
+#include "imjpeg.h"
CC_IMPLEMENT_DYNAMIC(ViewTab, OptionsTabs)
@@ -514,6 +515,9 @@
ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_TUNE));
}
+ BOOL fScaleJpg96dpi = FALSE; // Whether all JPEGs should be imported at 96DPI
+ fScaleJpg96dpi = pPrefsDlg->GetLongGadgetValue( _R(IDC_JPEG_96DPI_CHECK), 0, 1, 0, &Valid );
+ JPEGImportFilter::SetImportAt96dpi( fScaleJpg96dpi );
// Automatic colour line, gallery scroll to colour selected
State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_AUTOSCROLL), 0, 1, 0, &Valid);
@@ -543,16 +547,6 @@
// Proportional scrollbar state option (for main view) removed 10/10/05 by Marc.
// The current scrollbars are always proportional so it didn't make sense
-
- if (pView != NULL)
- {
- // Get the background redraw state and set new state accordingly
- BackgroundRedraw = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_BACKREDRAW), 0, 1, 0, &Valid);
- pView->SetForeBackMode(BackgroundRedraw);
- // The preference value is set from the default document.
- //SetOk = Camelot.SetPrefValue(TEXT("Rendering"), TEXT("BackgroundRendering"), &BackgroundRedraw);
- //ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_VIEW));
- }
// Read the state of the interactive fill editing switch and set the new value in the preferences
BOOL InteractiveFill = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_INTERACTIVEFILL), 0, 1, 0, &Valid);
@@ -647,12 +641,6 @@
if (!ok)
return TRUE; // Talk to page failed to return now
- // Make sure the information field displaying the name of the current document
- // is correct.
- String_256 DocumentName(_R(IDT_OPTS_VIEW_INFO));
- DocumentName += *GetDocumentName();
- pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocumentName);
-
// Only update if we are not already grey
if (GreyStatus == TRUE)
return TRUE;
@@ -689,12 +677,6 @@
if (!ok)
return TRUE; // Talk to page failed to return now
- // Make sure the information field displaying the name of the current document
- // is correct.
- String_256 DocumentName(_R(IDT_OPTS_VIEW_INFO));
- DocumentName += *GetDocumentName();
- pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocumentName);
-
BOOL bSmoothing = TRUE;
if (pDocument)
bSmoothing = pDocument->GetBitmapSmoothing();
@@ -747,11 +729,9 @@
// pPrefsDlg->EnableGadget(_OPTS_INTERACTIVEFILL, Status);
// pPrefsDlg->EnableGadget(_R(IDC_OPTS_AUTOTRANS), Status);
- pPrefsDlg->EnableGadget(_R(IDC_OPTS_INFO), Status);
// removed transparency control 27/8/96
// pPrefsDlg->EnableGadget(_R(IDC_OPTS_SHOWTRANS), Status);
pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCROLLBARS), Status);
- pPrefsDlg->EnableGadget(_R(IDC_OPTS_BACKREDRAW), Status);
pPrefsDlg->EnableGadget(_R(IDC_OPTS_SMOOTH_BITMAPS), Status);
@@ -790,11 +770,6 @@
// Update any document/view specific bits
GetDisplayStyleForView();
- // Set up the information field to reflect the current document name
- String_256 DocName(_R(IDT_OPTS_VIEW_INFO));
- DocName += *DocumentName;
- pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocName);
-
BOOL bSmoothing = TRUE;
if (pDocument)
bSmoothing = pDocument->GetBitmapSmoothing();
@@ -946,20 +921,6 @@
DocView *pView = DocView::GetSelected();
if (pView != NULL)
{
- BOOL BackgroundRedraw;
- // Set up the background redraw switch
- BackgroundRedraw = pView->GetForeBackMode();
- //ReadOk = Camelot.GetPrefValue(TEXT("Rendering"), TEXT("BackgroundRendering"), &BackgroundRedraw);
- TRACEUSER( "Neville", _T("get background redraw '%d'\n"),BackgroundRedraw);
- // Seems to return -1 so cannot use value directly
- if (BackgroundRedraw == FALSE)
- pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_BACKREDRAW), FALSE);
- else
- pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_BACKREDRAW), TRUE);
- //ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_VIEW));
-
- // Remember these values for later use
- OldBackgroundRedraw = BackgroundRedraw;
}
// Remember this value for later use
@@ -1070,12 +1031,6 @@
BOOL ReadOk = FALSE; // Flag to say whether the preference value was read ok
- // Make sure the information field displaying the name of the current document
- // is correct.
- String_256 DocumentName(_R(IDT_OPTS_VIEW_INFO));
- DocumentName += *GetDocumentName();
- pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocumentName);
-
// Section = Display
// Now the colour bar mode combo box
@@ -1164,6 +1119,8 @@
pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_COMPOUNDDPI), m_compoundConvertToEditableShapesDPI);
ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_VIEW));
+ // Set the force JPEG DPI flag
+ pPrefsDlg->SetLongGadgetValue( _R(IDC_JPEG_96DPI_CHECK), LONG(JPEGImportFilter::GetImportAt96dpi()) );
// Section = Window
Index: Trunk/XaraLX/Kernel/imjpeg.cpp
===================================================================
--- Trunk/XaraLX/Kernel/imjpeg.cpp (revision 1757)
+++ Trunk/XaraLX/Kernel/imjpeg.cpp (revision 1758)
@@ -152,8 +152,8 @@
CC_IMPLEMENT_MEMDUMP(JPEGImportFilter, BaseBitmapFilter)
CC_IMPLEMENT_MEMDUMP(JPEGImportOptions, BitmapImportOptions)
+BOOL JPEGImportFilter::m_fImportAt96dpi = m_fImportAt96dpi;
-
// We want better memory tracking
#define new CAM_DEBUG_NEW
@@ -247,6 +247,12 @@
FilterName.Load(_R(IDS_JPG_IMP_FILTERNAME));
FilterInfo.Load(_R(IDS_JPG_IMP_FILTERINFO));
+ if( 9999 == m_fImportAt96dpi &&
+ Camelot.DeclareSection( _T("Filters"), 10 ) )
+ {
+ Camelot.DeclarePref( NULL, _T("ImportJPEGAt96dpi"), &m_fImportAt96dpi, FALSE, TRUE );
+ }
+
// All ok
return TRUE;
}
@@ -1025,8 +1031,12 @@
// Set the horizontal & vertical pixel densities
LPBITMAPINFOHEADER pHeader = &(*m_ppInfo)->bmiHeader;
- switch (m_cinfo.density_unit)
+ // Conviently the import code defaults to 96dpi, so
+ // we just leave it alone if we're importing at 96dpi
+ if( !m_fImportAt96dpi )
{
+ switch (m_cinfo.density_unit)
+ {
case 1: // dots/inch
pHeader->biXPelsPerMeter = (INT32)(m_cinfo.X_density * (100 / 2.54));
pHeader->biYPelsPerMeter = (INT32)(m_cinfo.Y_density * (100 / 2.54));
@@ -1042,7 +1052,9 @@
// even when density_unit=0.
// So leave it as is: 96dpi
break;
+ }
}
+
return TRUE;
}
Index: Trunk/XaraLX/wxOil/xrc/EN/prefsdlg-sizer.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/prefsdlg-sizer.xrc (revision 1757)
+++ Trunk/XaraLX/wxOil/xrc/EN/prefsdlg-sizer.xrc (revision 1758)
@@ -99,48 +99,67 @@
<flag>wxGROW|wxLEFT|wxRIGHT|wxBOTTOM</flag>
<border>5</border>
<object class="wxStaticBoxSizer" name="IDC_OPTS_BITMAPS">
- <orient>wxHORIZONTAL</orient>
+ <orient>wxVERTICAL</orient>
<label>Bitmaps</label>
<font>
<size>8</size>
- </font>
+ </font>
+ <object class="sizeritem">
+ <flag>wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE</flag>
+ <border>5</border>
+ <option>1</option>
+ <object class="wxBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <object class="sizeritem">
+ <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
+ <border>5</border>
+ <object class="wxCheckBox" name="IDC_OPTS_SMOOTH_BITMAPS">
+ <pos>16,130</pos>
+ <font>
+ <size>8</size>
+ </font>
+ <label>N&ever smooth</label>
+ <checked>0</checked>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE</flag>
+ <border>5</border>
+ <option>1</option>
+ <object class="wxStaticText" name="IDC_OPTS_INFO2">
+ <pos>123,130</pos>
+ <font>
+ <size>8</size>
+ </font>
+ <style>wxALIGN_RIGHT</style>
+ <label>DPI when auto generated</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
+ <border>5</border>
+ <object class="wxTextCtrl" name="IDC_OPTS_COMPOUNDDPI">
+ <size>34,20</size>
+ <pos>258,126</pos>
+ <font>
+ <size>8</size>
+ </font>
+ </object>
+ </object>
+ </object>
+ </object>
<object class="sizeritem">
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
- <object class="wxCheckBox" name="IDC_OPTS_SMOOTH_BITMAPS">
- <pos>16,130</pos>
+ <object class="wxCheckBox" name="IDC_JPEG_96DPI_CHECK">
<font>
<size>8</size>
</font>
- <label>N&ever smooth</label>
+ <label>Import JPEGs at 96dpi (1:1)</label>
<checked>0</checked>
</object>
</object>
- <object class="sizeritem">
- <flag>wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE</flag>
- <border>5</border>
- <option>1</option>
- <object class="wxStaticText" name="IDC_OPTS_INFO2">
- <pos>123,130</pos>
- <font>
- <size>8</size>
- </font>
- <style>wxALIGN_RIGHT</style>
- <label>DPI when auto generated</label>
- </object>
- </object>
- <object class="sizeritem">
- <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
- <border>5</border>
- <object class="wxTextCtrl" name="IDC_OPTS_COMPOUNDDPI">
- <size>34,20</size>
- <pos>258,126</pos>
- <font>
- <size>8</size>
- </font>
- </object>
- </object>
- </object>
+ </object>
</object>
<object class="sizeritem">
<flag>wxGROW|wxLEFT|wxRIGHT|wxBOTTOM</flag>
@@ -222,29 +241,6 @@
</object>
</object>
</object>
- <object class="sizeritem">
- <flag>wxGROW|wxLEFT|wxRIGHT|wxBOTTOM</flag>
- <border>5</border>
- <object class="wxStaticBoxSizer" name="IDC_OPTS_INFO">
- <orient>wxHORIZONTAL</orient>
- <label>Windows options for</label>
- <font>
- <size>8</size>
- </font>
- <object class="sizeritem">
- <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
- <border>5</border>
- <object class="wxCheckBox" name="IDC_OPTS_BACKREDRAW">
- <pos>16,276</pos>
- <font>
- <size>8</size>
- </font>
- <label>Background &redraw</label>
- <checked>0</checked>
- </object>
- </object>
- </object>
- </object>
</object>
<title> View </title>
<label> View </label>
Xara