Commit Graph

94 Commits (681a50db26e200758423053b091cc7d9481380b7)

Author SHA1 Message Date
phkahler 142252ddf8 Add z distance checking to entity picking. Fixes issue 521 2020-11-17 18:58:18 -05:00
phkahler 5945d556a6 Add end marker to text window and increase max rows. 2020-11-07 21:57:15 +01:00
phkahler 668fe6f493 Make the redundant constraint timeout a configuration value and add the config UI elements to edit that value. 2020-09-16 16:39:43 -04:00
nabijaczleweli 028b613f10 Add ExportBackgroundColor config to GUI and CLI 2020-09-05 20:58:07 -04:00
whitequark a2962207dd Improve text screen for a selected entity.
* Add a link to its request, unless it's the first entity in that
    request (which would just select the same entity again).
  * Add a link to its group.
  * Add a link to its workplane.
  * Add a link to its style; and hide the style row for entities that
    aren't stylable.
  * Show constraints and measurements (reference constraints) in
    separate lists.
  * For curve entities, show constraints that apply to the points
    related to the curve, not just to the curve itself.
2020-08-07 18:06:42 +00:00
whitequark afa9e2890e Improve text screen for a selected constraint.
* Show the type of a constraint.
  * Show the workplane a constraint is in, for constraints which can
    be both projected to workplane or be free in 3d space.
  * Clearly distinguish reference from non-reference constraints.
  * Add a checkbox for toggling the reference option.
  * When showing requests a constraint applies to, highlight on hover
    the specific entity being constrained, not just the first one.
2020-08-07 18:06:42 +00:00
phkahler 188b2e26ce Implement #524 Allow flat colors. Adds an edit control for Ambient lighting. 2020-07-18 02:15:41 +00:00
Tim 72635df56e
Add menu options for line styles / view / configuration.
This is to make them a bit easier to find, since the natural place
to look for config options is somewhere like File->Preferences or
Edit->Settings.
2020-04-01 21:25:18 +00:00
Koen Schmeets dcdfdec564 Add an option to edit dimension immediately after adding. 2019-11-26 22:34:53 +00:00
whitequark f0359556d8 Recompute property browser viewport on resize.
Before this commit, resizing the property browser would cut off
the rows at the bottom, or else add black space, until next refresh.

This could be perhaps more elegantly done by adding an onResize event
but given that each of them would be followed by onRender anyway, it
seems there's no benefit to adding onResize.
2019-11-23 15:04:31 +00:00
phkahler 986da7d224 Implement helical extrusion groups. 2019-07-31 04:16:56 +00:00
phkahler 5df53fc59e Implement revolve groups. 2019-06-03 17:32:38 +00:00
whitequark 6352405206 Deselect entities with Ctrl-LMB.
In other words, Ctrl inverts the normal action of LMB. It is already
possible to deselect entities through the context menu, but that
can be very awkward on laptop touchpads with a crowded sketch; with
Ctrl, a misclick is easily corrected without moving cursor at all.
2019-05-24 19:11:56 +00:00
EvilSpirit 9d1c295495 Add a setting to format constraint labels using SI prefixes.
Supported metric units: km, m, cm, mm, µm, nm.
Supported USCS units: in, mil, µin.

Also, use the newly introduced unit formatting machinery in tools for
measuring perimeter, area and volume, so that e.g. volume is not
displayed in millions of cubic millimeters.
2019-05-24 12:31:41 +00:00
whitequark ac7b82d7c1 Allow configuring the amount of digits displayed after decimal point.
This is useful in niche cases, like making angular measurement tools.

Also, use simpler and more principled code for numeric precision
while editing constraints: don't special-case angles, but use up to
10 digits after the decimal point for everything.
2019-05-23 17:53:53 +00:00
whitequark 50c004b679 Add a button to hide construction entities.
Also, mark not just curves, but also points and normals derived from
construction requests as construction.

Also, don't always mark arc center point as construction just to
exclude it from chord tolerance bounding box calculation; instead,
special-case it there.
2019-05-23 16:29:00 +00:00
Dynamo Dan e67f967933 Implement turntable (SketchUp-like) mouse navigation. 2019-05-23 15:45:15 +00:00
whitequark 3296474c15 Rework tooltip implementation to track tip area.
This fixes an elusive GTK issue where tooltips would be spuriously
displayed, and makes tooltips behave nicer on Windows.

Unfortunately the macOS code is unchanged as the macOS tooltip
implementation seems seriously broken in ways I do not understand.
2019-05-23 13:54:24 +00:00
Sergiusz Bazanski 9e512882d1 Add checkbox to control automatic line constraints
Signed-off-by: Sergiusz Bazanski <q3k@q3k.org>
2019-02-11 13:17:38 +00:00
Bauke Conijn e69478e61a Let tangent arc modify the original entities.
Modifying the original entities instead of deleting them, retains the
original associated constraints. This makes creating rounded rectangles
a lot easier.
2019-02-11 10:45:11 +00:00
luz.paz 258545a334 Misc. typos
Found via `codespell -q 3 --skip="./res/locales,./extlib"`
2018-09-19 18:52:11 +00:00
whitequark a738e3f82e Eliminate imperative redraws.
This commit removes Platform::Window::Redraw function, and rewrites
its uses to run on timer events. Most UI toolkits have obscure issues
with recursive event handling loops, and Emscripten is purely event-
driven and cannot handle imperative redraws at all.

As a part of this change, the Platform::Timer::WindUp function
is split into three to make the interpretation of its argument
less magical. The new functions are RunAfter (a regular timeout,
setTimeout in browser terms), RunAfterNextFrame (an animation
request, requestAnimationFrame in browser terms), and
RunAfterProcessingEvents (a request to run something after all
events for the current frame are processed, used for coalescing
expensive operations in face of input event queues).

This commit changes two uses of Redraw(): the AnimateOnto() and
ScreenStepDimGo() functions. The latter was actually broken in that
on small sketches, it would run very quickly and not animate
the dimension change at all; this has been fixed.

While we're at it, get rid of unused Platform::Window::NativePtr
function as well.
2018-07-18 23:18:02 +00:00
whitequark c1f1c7c409 Add a platform abstraction for 6-DOF input devices.
This commit mostly just moves code around.
2018-07-18 01:05:19 +00:00
whitequark 6b5db58971 Add a platform abstraction for file dialogs.
This commit merges all ad-hoc file dialog code, such as the feature
where dialogs remember last location and format, and exposes it
through a common interface.

This commit also significantly improves Gtk dialog handling code.
2018-07-17 22:33:45 +00:00
whitequark f324477dd0 Implement a platform abstraction for windows.
This commit removes a large amount of code partially duplicated
between the text and the graphics windows, and opens the path to
having more than one model window on screen at any given time,
as well as simplifies platform work.

This commit also adds complete support for High-DPI device pixel
ratio. It adds support for font scale factor (a fractional factor
on top of integral device pixel ratio) on the platform side, but not
on the application side.

This commit also adds error checking to all Windows API calls
(within the abstracted code) and fixes a significant number of
misuses and non-future-proof uses of Windows API.

This commit also makes uses of Windows API idiomatic, e.g. using
the built-in vertical scroll bar, native tooltips, control
subclassing instead of hooks in the global dispatch loop, and so on.

It reinstates tooltip support and removes menu-related hacks.
2018-07-17 13:31:17 +00:00
whitequark 55baaf310f Implement a platform abstraction for menus.
This commit removes a large amount of redundant code that needed
to be kept in sync between platforms and also makes it much easier
to add new menu-related functionality since little to no platform
code needs to be altered anymore.

This commit also greatly improves code locality in context menu
handling by allowing context menu click handlers to be closures.

This commit temporarily introduces a SetMainMenu API, which is rather
hacky but only necessary until an abstraction for windows is added.
2018-07-16 11:21:30 +00:00
whitequark 7ab87caa88 Implement a platform abstraction for timers.
This commit temporarily disables tooltip functionality; it will
be handled natively in a platform abstraction for windows using
much simpler code.
2018-07-16 11:21:30 +00:00
whitequark f54dabbb5f Clean up includes and include guards.
According to the C standard all preprocessor definitions starting
with an underscore are reserved for standard and implementation use,
so don't use those. Also, sort and unique include directives.
2018-07-12 18:48:51 +00:00
EvilSpirit a16c204304 Allow using m (in addition to mm and inch) as base unit. 2018-07-12 12:01:46 +00:00
EvilSpirit 99f6ea34f1 Add an option to display areas of closed contours.
This is useful e.g. for architectural work.
2017-04-08 16:43:06 +00:00
whitequark 7eb6574f90 Rename TextWindow::CHAR_WIDTH to CHAR_WIDTH_.
glibc defines a CHAR_WIDTH macro in limits.h since about 6.3.*.
This is apparently added as a part of ISO TS 18661-1:2014, which
I cannot read because it is not publicly available, and which covers
some sort of floating-point extensions. This is one of those changes
that should never have been done yet here we are.
2017-04-06 06:54:07 +00:00
whitequark ca2aad7fea Remove the "style → background image" feature. 2017-03-13 01:12:58 +00:00
EvilSpirit 5744d1d599 Implement an image request. 2017-03-12 00:13:56 +00:00
whitequark d77f617dc4 Remove the "show menu bar" option.
Hiding the menu bar was only supported on macOS, and it is inherently
troublesome to port because keyboard accelerators on Win32 and GTK
are inherently dependent on the menu bar being visible.

On top of that, it's not clear how to bring it back if it's hidden
by accident.
2017-02-06 15:11:58 +00:00
EvilSpirit 97e71856b3 Snap point to entity when constraining to a hovered entity.
Before this commit, when a point is constrained to an entity (point,
circle, arc of circle or line segment) by clicking on it,
the resulting constraint is not necessarily satisfied, and the next
regeneration may place the newly constrained point somewhere other
than the intended position. After this commit, the parameters
are modified to satisfy the constraint.
2017-02-06 14:20:19 +00:00
EvilSpirit d4b052d34d Fix logic introduced in 55ae10b.
Before this commit, the effect of the AddPending() call was
immediately reversed by ClearSuper.
2017-01-24 20:30:48 +00:00
EvilSpirit db75e06ecc Add a command to show center of mass, assuming uniform density. 2017-01-19 08:54:11 +00:00
EvilSpirit 55ae10b5b8 Do not hover or select entities from any pending request. 2017-01-11 04:16:59 +00:00
whitequark c12672be66 Internationalize platform-specific code. 2017-01-11 03:02:04 +00:00
whitequark 984f74d271 Internationalize all messages without substitutions. 2017-01-07 06:47:40 +00:00
whitequark 00dda08917 Internationalize the context menu. 2017-01-05 12:35:50 +00:00
whitequark 529e1bfd63 Internationalize the main menu. 2017-01-05 12:17:09 +00:00
Elvira Khabirova 4f04406121 Implement a gettext .po file parser. 2017-01-05 12:14:40 +00:00
EvilSpirit 25631d4fb2 Choose entities to select in a way appropriate for the operation.
Before this commit, when an entity is clicked at or dragged, and it
shares a place with other entities, which of them is selected is
decided more or less at random. This is particularly annoying when
dragging.

After this commit, when clicking, an entity from the current group
is given preference, and when dragging, an entity from a request
is given preference. This allows e.g. dragging points of a sketch
even when an extrusion of that sketch is active.
2017-01-02 12:21:01 +00:00
EvilSpirit 52557ee979 Add an interface for view-independent rendering.
To actually achieve improved performance with the OpenGL 2 renderer,
we have to cache geometry that doesn't change when the viewport does
(note that the rendered pixels can change quite dramatically because
we can reconfigure shaders; e.g. stippling can be drawn in screen
coordinates).

This commit adds a BatchCanvas interface that can be implemented
by renderers, and uses it for drawing entities such as lines and
points.
2016-11-18 04:04:32 +00:00
EvilSpirit 7b9d730a23 Hide OpenGL implementation details.
Abstract the exact details of the OpenGL renderer in the render.h
header; this allows us to use GL-specific types in the renderer
class and functions without including OpenGL (and Windows, where
applicable) headers in every source file.
2016-11-14 20:30:46 +00:00
whitequark 21a4305ee1 Add "Zoom to Fit" to context menu. 2016-10-09 22:26:36 +00:00
whitequark 2f64f18095 Add "Select All" to context menu for no selection. 2016-10-09 22:26:25 +00:00
whitequark 2f4c6a6b0e Add "Toggle Construction" to context menu. 2016-10-09 22:13:01 +00:00
whitequark da2d035200 Remove exact numeric values from ContextCommand.
They carry no meaning, except for FIRST_STYLE.
2016-10-09 22:08:22 +00:00