Skip to content

Commit

Permalink
#5637: Maximum zoom factor of XY views is now configurable, the defau…
Browse files Browse the repository at this point in the history
…lt value has been double a few times.
  • Loading branch information
codereader committed Jun 11, 2021
1 parent 50c8993 commit da81e63
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions install/user.xml
Expand Up @@ -163,6 +163,7 @@
<showCoordinates value="1" />
<showOutline value="0" />
<showAxes value="1" />
<maxZoomFactor value="1024" />
<showWorkzone value="0" />
<fontSize value="14" />
<fontStyle value="Sans" />
Expand Down
2 changes: 1 addition & 1 deletion radiant/ui/prefdialog/PrefDialog.cpp
Expand Up @@ -100,7 +100,7 @@ void PrefDialog::showModal(const std::string& requestedPage)
_notebook->ExpandNode(page, true);
}

FitToScreen(0.7f, 0.5f);
FitToScreen(0.7f, 0.6f);

// Is there a specific page display request?
if (!requestedPage.empty())
Expand Down
12 changes: 11 additions & 1 deletion radiant/xyview/GlobalXYWnd.cpp
Expand Up @@ -47,12 +47,14 @@ namespace
const std::string RKEY_TRANSLATE_CONSTRAINED = "user/ui/xyview/translateConstrained";
const std::string RKEY_FONT_SIZE = "user/ui/xyview/fontSize";
const std::string RKEY_FONT_STYLE = "user/ui/xyview/fontStyle";
const std::string RKEY_MAX_ZOOM_FACTOR = "user/ui/xyview/maxZoomFactor";

const int DEFAULT_CHASE_MOUSE_CAP = 32; // pixels per chase moue timer interval
}

// Constructor
XYWndManager::XYWndManager()
XYWndManager::XYWndManager() :
_maxZoomFactor(1024)
{}

/* greebo: This method restores all xy views from the information stored in the registry.
Expand Down Expand Up @@ -200,6 +202,7 @@ void XYWndManager::constructPreferences()
page.appendCheckBox(_("Show Workzone"), RKEY_SHOW_WORKZONE);
page.appendCheckBox(_("Translate Manipulator always constrained to Axis"), RKEY_TRANSLATE_CONSTRAINED);
page.appendCheckBox(_("Higher Selection Priority for Entities"), RKEY_HIGHER_ENTITY_PRIORITY);
page.appendSpinner(_("Maximum Zoom Factor"), RKEY_MAX_ZOOM_FACTOR, 1, 65536, 0);
page.appendCombo(_("Font Style"), RKEY_FONT_STYLE, { "Sans", "Mono" }, true);
page.appendSpinner(_("Font Size"), RKEY_FONT_SIZE, 4, 48, 0);
}
Expand All @@ -221,6 +224,7 @@ void XYWndManager::refreshFromRegistry()
_defaultBlockSize = registry::getValue<int>(RKEY_DEFAULT_BLOCKSIZE);
_fontSize = registry::getValue<int>(RKEY_FONT_SIZE);
_fontStyle = registry::getValue<std::string>(RKEY_FONT_STYLE) == "Sans" ? IGLFont::Style::Sans : IGLFont::Style::Mono;
_maxZoomFactor = registry::getValue<float>(RKEY_MAX_ZOOM_FACTOR);

updateAllViews();

Expand Down Expand Up @@ -289,6 +293,11 @@ IGLFont::Style XYWndManager::fontStyle() const
return _fontStyle;
}

float XYWndManager::maxZoomFactor() const
{
return _maxZoomFactor;
}

void XYWndManager::updateAllViews(bool force)
{
for (const XYWndMap::value_type& i : _xyWnds)
Expand Down Expand Up @@ -689,6 +698,7 @@ void XYWndManager::initialiseModule(const IApplicationContext& ctx)
observeKey(RKEY_DEFAULT_BLOCKSIZE);
observeKey(RKEY_FONT_SIZE);
observeKey(RKEY_FONT_STYLE);
observeKey(RKEY_MAX_ZOOM_FACTOR);

// Trigger loading the values of the observed registry keys
refreshFromRegistry();
Expand Down
3 changes: 3 additions & 0 deletions radiant/xyview/GlobalXYWnd.h
Expand Up @@ -46,6 +46,8 @@ class XYWndManager :
int _fontSize;
IGLFont::Style _fontStyle;

std::size_t _maxZoomFactor;

private:

// Get a unique ID for the XYWnd map
Expand All @@ -72,6 +74,7 @@ class XYWndManager :
bool showSizeInfo() const;
int fontSize() const;
IGLFont::Style fontStyle() const;
float maxZoomFactor() const;

unsigned int defaultBlockSize() const;

Expand Down
2 changes: 1 addition & 1 deletion radiant/xyview/XYWnd.cpp
Expand Up @@ -1562,7 +1562,7 @@ void XYWnd::zoomOut()

void XYWnd::zoomIn()
{
float max_scale = 64;
float max_scale = GlobalXYWnd().maxZoomFactor();
float scale = getScale() * 5.0f / 4.0f;

if (scale > max_scale) {
Expand Down

0 comments on commit da81e63

Please sign in to comment.