Skip to content

Commit

Permalink
Two Zoom Changes (Resolution and Extrema) (#597)
Browse files Browse the repository at this point in the history
Activate the 125x assets by making them callable in CScalableBitmap,
activating them in win script, and re-rendering the win resource files.

Also add a function "Zoom to Largest" which takes zoom to exactly the
point below where we would warn that you can't zoom any larger for your
screen, and "Zoom to Smallest", so that @sense-amr can do crazy things
with bitwig and Orca.

Moreover on smaller monitors, 95% zoom in logic pro is too large
and eats the menu button due to decoration, so in this change
we move to 90% of screen as max for all oses.

Closes #540: Activate 125% assets
Closes #590: Zoom to Biggest Menu
  • Loading branch information
baconpaul authored Feb 15, 2019
1 parent dde17b5 commit 571a3d3
Show file tree
Hide file tree
Showing 6 changed files with 309 additions and 198 deletions.
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 @@ -2523,11 +2523,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 @@ -2603,6 +2599,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 @@ -83,10 +83,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

Expand Down
Loading

0 comments on commit 571a3d3

Please sign in to comment.