Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two Zoom Changes (Resolution and Extrema) #597

Merged
merged 1 commit into from
Feb 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion scripts/win/emit-vector-rc.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
IDBtoDigit = {}
scaleToOffset = {}

scales = [ "100", "125", "150", "200", "300", "400" ]
xtnToPostfix = { "": "_SCALE_100",
"@125x": "_SCALE_125",
"@15x": "_SCALE_150",
"@2x": "_SCALE_200",
"@3x": "_SCALE_300",
Expand Down Expand Up @@ -87,7 +89,7 @@
""")
for idb in IDBs:
subRes.write( "\n// Offset {0} by SCALABLE_100_OFFSET value and so on\n".format( idb ) )
for sc in [ "100", "150", "200", "300", "400" ]:
for sc in scales:
line = "#define {0}_SCALE_{1} {2} \n".format(
idb, sc, (IDBtoDigit[ idb ] + scaleToOffset[ sc ] ) )
subRes.write( line )
Expand Down
4 changes: 3 additions & 1 deletion src/common/gui/CScalableBitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ CScalableBitmap::CScalableBitmap(CResourceDescription desc)
** things like a 1.25 bitmap set.
*/

scales = {{ 100, 150, 200, 300, 400 }}; // This is the collection of sizes we currently ask skins to export.
scales = {{ 100, 125, 150, 200, 300, 400 }}; // This is the collection of sizes we currently ask skins to export.

std::map< int, std::string > scaleFilePostfixes;
scaleFilePostfixes[ 100 ] = "";
scaleFilePostfixes[ 125 ] = "@125x";
scaleFilePostfixes[ 150 ] = "@15x";
scaleFilePostfixes[ 200 ] = "@2x";
scaleFilePostfixes[ 300 ] = "@3x";
Expand All @@ -60,6 +61,7 @@ CScalableBitmap::CScalableBitmap(CResourceDescription desc)
// Only windows uses this integer indexing and knows these offsets
std::map< int, int > scaleIDOffsets;
scaleIDOffsets[ 100 ] = SCALABLE_100_OFFSET;
scaleIDOffsets[ 125 ] = SCALABLE_125_OFFSET;
scaleIDOffsets[ 150 ] = SCALABLE_150_OFFSET;
scaleIDOffsets[ 200 ] = SCALABLE_200_OFFSET;
scaleIDOffsets[ 300 ] = SCALABLE_300_OFFSET;
Expand Down
26 changes: 22 additions & 4 deletions src/common/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2465,11 +2465,7 @@ void SurgeGUIEditor::setZoomFactor(int zf)
** Keep these as integers to be consistent wiht the other zoom factors, and to make
** the error message cleaner.
*/
#ifdef WINDOWS
int maxScreenUsage = 90;
#else
int maxScreenUsage = 95;
#endif

if (zf != 100.0 && zf > 100 && (
(baseW * zf / 100.0) > maxScreenUsage * screenDim.getWidth() / 100.0 ||
Expand Down Expand Up @@ -2545,6 +2541,28 @@ void SurgeGUIEditor::showSettingsMenu(CRect &menuRect)
zoomSubMenu->addEntry(zcmd); zid++;
}

zoomSubMenu->addEntry("-", zid++);
CCommandMenuItem *biggestZ = new CCommandMenuItem(CCommandMenuItem::Desc("Zoom to Largest"));
biggestZ->setActions([this, &handled](CCommandMenuItem *m)
{
int newZF = findLargestFittingZoomBetween(100.0, 500.0, 5,
90, // See comment in setZoomFactor
WINDOW_SIZE_X, WINDOW_SIZE_Y );
setZoomFactor(newZF);
handled = true;
}
);
zoomSubMenu->addEntry(biggestZ);

CCommandMenuItem *smallestZ = new CCommandMenuItem(CCommandMenuItem::Desc("Zoom to Smallest"));
smallestZ->setActions([this, &handled](CCommandMenuItem *m)
{
setZoomFactor(50); // This is the 'minZoom' value from setZoomFactor
handled = true;
}
);
zoomSubMenu->addEntry(smallestZ);

settingsMenu->addEntry(zoomSubMenu, "Zoom"); eid++;

settingsMenu->addSeparator(eid++);
Expand Down
9 changes: 5 additions & 4 deletions src/common/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@
** This is windows only. Mac and Linux use different resource approaches
*/
#define SCALABLE_100_OFFSET 70000
#define SCALABLE_150_OFFSET 71000
#define SCALABLE_200_OFFSET 72000
#define SCALABLE_300_OFFSET 73000
#define SCALABLE_400_OFFSET 74000
#define SCALABLE_125_OFFSET 71000
#define SCALABLE_150_OFFSET 72000
#define SCALABLE_200_OFFSET 73000
#define SCALABLE_300_OFFSET 74000
#define SCALABLE_400_OFFSET 75000

#include "scalableresource.h" // found in src/windows
#endif
Loading