Implement "view → set to full scale" text window command.
parent
ff23a4a471
commit
8e7d2eaa84
|
@ -11,6 +11,8 @@ New export/import features:
|
|||
Other new features:
|
||||
* New command for measuring total length of selected entities,
|
||||
"Analyze → Measure Perimeter".
|
||||
* New link to match the on-screen size of the sketch with its actual size,
|
||||
"view → set to full scale".
|
||||
|
||||
2.2
|
||||
---
|
||||
|
|
|
@ -6,6 +6,11 @@
|
|||
name="JonathanWesthues.3dCAD.SolveSpace"
|
||||
type="win32"
|
||||
/>
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
<description>Parametric 3d CAD tool.</description>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
|
|
|
@ -1045,6 +1045,15 @@ void GetTextWindowSize(int *w, int *h) {
|
|||
*h = (int)size.height;
|
||||
}
|
||||
|
||||
double GetScreenDpi() {
|
||||
NSScreen *screen = [NSScreen mainScreen];
|
||||
NSDictionary *description = [screen deviceDescription];
|
||||
NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue];
|
||||
CGSize displayPhysicalSize = CGDisplayScreenSize(
|
||||
[[description objectForKey:@"NSScreenNumber"] unsignedIntValue]);
|
||||
return (displayPixelSize.width / displayPhysicalSize.width) * 25.4f;
|
||||
}
|
||||
|
||||
void InvalidateText(void) {
|
||||
NSSize size = [TWView convertSizeToBacking:[TWView frame].size];
|
||||
size.height = (SS.TW.top[SS.TW.rows - 1] + 1) * TextWindow::LINE_HEIGHT / 2;
|
||||
|
|
|
@ -1420,6 +1420,10 @@ void GetTextWindowSize(int *w, int *h) {
|
|||
*h = allocation.get_height();
|
||||
}
|
||||
|
||||
double GetScreenDpi() {
|
||||
return Gdk::Screen::get_default()->get_resolution();
|
||||
}
|
||||
|
||||
void InvalidateText(void) {
|
||||
TW->get_widget().queue_draw();
|
||||
}
|
||||
|
|
|
@ -96,6 +96,9 @@ void ScheduleLater() {
|
|||
void GetGraphicsWindowSize(int *w, int *h) {
|
||||
*w = *h = 600;
|
||||
}
|
||||
double GetScreenDpi() {
|
||||
return 72;
|
||||
}
|
||||
|
||||
void InvalidateGraphics() {
|
||||
}
|
||||
|
|
|
@ -266,6 +266,13 @@ void SolveSpace::GetTextWindowSize(int *w, int *h)
|
|||
GetWindowSize(TextWnd, w, h);
|
||||
}
|
||||
|
||||
double SolveSpace::GetScreenDpi() {
|
||||
HDC hdc = GetDC(NULL);
|
||||
double dpi = GetDeviceCaps(hdc, LOGPIXELSX);
|
||||
ReleaseDC(NULL, hdc);
|
||||
return dpi;
|
||||
}
|
||||
|
||||
void SolveSpace::OpenWebsite(const char *url) {
|
||||
ShellExecuteW(GraphicsWnd, L"open", Widen(url).c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
|
|
|
@ -264,6 +264,7 @@ void ToggleFullScreen();
|
|||
bool FullScreenIsActive();
|
||||
void GetGraphicsWindowSize(int *w, int *h);
|
||||
void GetTextWindowSize(int *w, int *h);
|
||||
double GetScreenDpi();
|
||||
int64_t GetMilliseconds();
|
||||
|
||||
void dbp(const char *str, ...);
|
||||
|
|
1
src/ui.h
1
src/ui.h
|
@ -457,6 +457,7 @@ public:
|
|||
static void ScreenChangeBackgroundImageScale(int link, uint32_t v);
|
||||
static void ScreenChangePasteTransformed(int link, uint32_t v);
|
||||
static void ScreenChangeViewScale(int link, uint32_t v);
|
||||
static void ScreenChangeViewToFullScale(int link, uint32_t v);
|
||||
static void ScreenChangeViewOrigin(int link, uint32_t v);
|
||||
static void ScreenChangeViewProjection(int link, uint32_t v);
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ void TextWindow::ShowEditView() {
|
|||
SS.GW.scale * SS.MmPerUnit(),
|
||||
SS.UnitName(),
|
||||
&ScreenChangeViewScale);
|
||||
Printf(false, "%Bd %Fl%Ll%fset to full scale%E",
|
||||
&ScreenChangeViewToFullScale);
|
||||
Printf(false, "");
|
||||
|
||||
Printf(false, "%Bd %Ftorigin (maps to center of screen)%E");
|
||||
|
@ -42,6 +44,10 @@ void TextWindow::ScreenChangeViewScale(int link, uint32_t v) {
|
|||
SS.TW.ShowEditControl(3, ssprintf("%.3f", SS.GW.scale * SS.MmPerUnit()));
|
||||
}
|
||||
|
||||
void TextWindow::ScreenChangeViewToFullScale(int link, uint32_t v) {
|
||||
SS.GW.scale = GetScreenDpi() / 25.4;
|
||||
}
|
||||
|
||||
void TextWindow::ScreenChangeViewOrigin(int link, uint32_t v) {
|
||||
std::string edit_value =
|
||||
ssprintf("%s, %s, %s",
|
||||
|
|
Loading…
Reference in New Issue