2013-07-28 22:08:34 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// The text-based browser window, used to view the structure of the model by
|
|
|
|
// groups and for other similar purposes.
|
|
|
|
//
|
|
|
|
// Copyright 2008-2013 Jonathan Westhues.
|
|
|
|
//-----------------------------------------------------------------------------
|
2008-06-23 08:37:12 +00:00
|
|
|
#include "solvespace.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2008-07-10 06:11:56 +00:00
|
|
|
// A navigation bar that always appears at the top of the window, with a
|
|
|
|
// link to bring us back home.
|
2008-06-23 08:37:12 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenHome(int link, uint32_t v) {
|
2008-07-10 06:11:56 +00:00
|
|
|
SS.TW.GoToScreen(SCREEN_LIST_OF_GROUPS);
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
|
|
|
void TextWindow::ShowHeader(bool withNav) {
|
|
|
|
ClearScreen();
|
|
|
|
|
2010-05-03 05:04:42 +00:00
|
|
|
char cd[1024], cd2[1024];
|
|
|
|
if(SS.GW.LockedInWorkplane()) {
|
|
|
|
sprintf(cd, "in plane: ");
|
|
|
|
strcpy(cd2, SK.GetEntity(SS.GW.ActiveWorkplane())->DescriptionString());
|
|
|
|
} else {
|
|
|
|
sprintf(cd, "drawing / constraining in 3d");
|
|
|
|
strcpy(cd2, "");
|
|
|
|
}
|
2008-06-23 08:37:12 +00:00
|
|
|
|
|
|
|
// Navigation buttons
|
|
|
|
if(withNav) {
|
2010-05-03 05:04:42 +00:00
|
|
|
Printf(false, " %Fl%Lh%fhome%E %Ft%s%E%s",
|
|
|
|
(&TextWindow::ScreenHome), cd, cd2);
|
2008-06-23 08:37:12 +00:00
|
|
|
} else {
|
2010-05-03 05:04:42 +00:00
|
|
|
Printf(false, " %Ft%s%E%s", cd, cd2);
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
|
|
|
|
2010-05-03 05:04:42 +00:00
|
|
|
// Leave space for the icons that are painted here.
|
|
|
|
Printf(false, "");
|
|
|
|
Printf(false, "");
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// The screen that shows a list of every group in the sketch, with options
|
|
|
|
// to hide or show them, and to view them in detail. This is our home page.
|
|
|
|
//-----------------------------------------------------------------------------
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenSelectGroup(int link, uint32_t v) {
|
2008-07-10 06:11:56 +00:00
|
|
|
SS.TW.GoToScreen(SCREEN_GROUP_INFO);
|
|
|
|
SS.TW.shown.group.v = v;
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenToggleGroupShown(int link, uint32_t v) {
|
2008-06-23 08:37:12 +00:00
|
|
|
hGroup hg = { v };
|
2009-04-19 05:53:16 +00:00
|
|
|
Group *g = SK.GetGroup(hg);
|
2008-06-23 08:37:12 +00:00
|
|
|
g->visible = !(g->visible);
|
|
|
|
// If a group was just shown, then it might not have been generated
|
|
|
|
// previously, so regenerate.
|
|
|
|
SS.GenerateAll();
|
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenShowGroupsSpecial(int link, uint32_t v) {
|
2008-06-23 08:37:12 +00:00
|
|
|
int i;
|
2009-04-19 05:53:16 +00:00
|
|
|
for(i = 0; i < SK.group.n; i++) {
|
|
|
|
Group *g = &(SK.group.elem[i]);
|
2008-06-23 08:37:12 +00:00
|
|
|
|
|
|
|
if(link == 's') {
|
|
|
|
g->visible = true;
|
|
|
|
} else {
|
|
|
|
g->visible = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenActivateGroup(int link, uint32_t v) {
|
2008-06-23 08:37:12 +00:00
|
|
|
hGroup hg = { v };
|
2009-04-19 05:53:16 +00:00
|
|
|
Group *g = SK.GetGroup(hg);
|
2008-06-23 08:37:12 +00:00
|
|
|
g->visible = true;
|
|
|
|
SS.GW.activeGroup.v = v;
|
2009-04-19 05:53:16 +00:00
|
|
|
SK.GetGroup(SS.GW.activeGroup)->Activate();
|
2008-06-23 08:37:12 +00:00
|
|
|
SS.GW.ClearSuper();
|
|
|
|
}
|
|
|
|
void TextWindow::ReportHowGroupSolved(hGroup hg) {
|
|
|
|
SS.GW.ClearSuper();
|
2008-07-10 06:11:56 +00:00
|
|
|
SS.TW.GoToScreen(SCREEN_GROUP_SOLVE_INFO);
|
|
|
|
SS.TW.shown.group.v = hg.v;
|
2015-03-18 17:02:11 +00:00
|
|
|
SS.ScheduleShowTW();
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenHowGroupSolved(int link, uint32_t v) {
|
2008-06-23 08:37:12 +00:00
|
|
|
if(SS.GW.activeGroup.v != v) {
|
|
|
|
ScreenActivateGroup(link, v);
|
|
|
|
}
|
2008-07-10 06:11:56 +00:00
|
|
|
SS.TW.GoToScreen(SCREEN_GROUP_SOLVE_INFO);
|
|
|
|
SS.TW.shown.group.v = v;
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenShowConfiguration(int link, uint32_t v) {
|
2008-07-10 06:11:56 +00:00
|
|
|
SS.TW.GoToScreen(SCREEN_CONFIGURATION);
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenShowEditView(int link, uint32_t v) {
|
2010-01-04 00:35:28 +00:00
|
|
|
SS.TW.GoToScreen(SCREEN_EDIT_VIEW);
|
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenGoToWebsite(int link, uint32_t v) {
|
2009-10-01 10:35:11 +00:00
|
|
|
OpenWebsite("http://solvespace.com/txtlink");
|
2008-02-09 13:52:01 +00:00
|
|
|
}
|
2008-06-23 08:37:12 +00:00
|
|
|
void TextWindow::ShowListOfGroups(void) {
|
2010-05-09 18:25:23 +00:00
|
|
|
char radioTrue[] = { ' ', (char)RADIO_TRUE, ' ', 0 },
|
|
|
|
radioFalse[] = { ' ', (char)RADIO_FALSE, ' ', 0 },
|
|
|
|
checkTrue[] = { ' ', (char)CHECK_TRUE, ' ', 0 },
|
|
|
|
checkFalse[] = { ' ', (char)CHECK_FALSE, ' ', 0 };
|
|
|
|
|
|
|
|
Printf(true, "%Ft active");
|
|
|
|
Printf(false, "%Ft shown ok group-name%E");
|
2008-06-23 08:37:12 +00:00
|
|
|
int i;
|
|
|
|
bool afterActive = false;
|
2009-04-19 05:53:16 +00:00
|
|
|
for(i = 0; i < SK.group.n; i++) {
|
|
|
|
Group *g = &(SK.group.elem[i]);
|
2008-06-23 08:37:12 +00:00
|
|
|
char *s = g->DescriptionString();
|
|
|
|
bool active = (g->h.v == SS.GW.activeGroup.v);
|
|
|
|
bool shown = g->visible;
|
2009-04-20 07:30:09 +00:00
|
|
|
bool ok = (g->solved.how == System::SOLVED_OKAY);
|
2008-06-23 08:37:12 +00:00
|
|
|
bool ref = (g->h.v == Group::HGROUP_REFERENCES.v);
|
|
|
|
Printf(false, "%Bp%Fd "
|
2010-05-09 18:25:23 +00:00
|
|
|
"%Ft%s%Fb%D%f%Ll%s%E "
|
|
|
|
"%Fb%s%D%f%Ll%s%E "
|
2008-06-23 08:37:12 +00:00
|
|
|
"%Fp%D%f%s%Ll%s%E "
|
|
|
|
"%Fl%Ll%D%f%s",
|
|
|
|
// Alternate between light and dark backgrounds, for readability
|
2010-05-09 18:25:23 +00:00
|
|
|
(i & 1) ? 'd' : 'a',
|
2008-06-23 08:37:12 +00:00
|
|
|
// Link that activates the group
|
2010-05-09 18:25:23 +00:00
|
|
|
ref ? " " : "",
|
|
|
|
g->h.v, (&TextWindow::ScreenActivateGroup),
|
|
|
|
ref ? "" : (active ? radioTrue : radioFalse),
|
2008-06-23 08:37:12 +00:00
|
|
|
// Link that hides or shows the group
|
2010-05-09 18:25:23 +00:00
|
|
|
afterActive ? " - " : "",
|
|
|
|
g->h.v, (&TextWindow::ScreenToggleGroupShown),
|
|
|
|
afterActive ? "" : (shown ? checkTrue : checkFalse),
|
2008-06-23 08:37:12 +00:00
|
|
|
// Link to the errors, if a problem occured while solving
|
|
|
|
ok ? 's' : 'x', g->h.v, (&TextWindow::ScreenHowGroupSolved),
|
|
|
|
ok ? "ok" : "",
|
|
|
|
ok ? "" : "NO",
|
|
|
|
// Link to a screen that gives more details on the group
|
|
|
|
g->h.v, (&TextWindow::ScreenSelectGroup), s);
|
|
|
|
|
|
|
|
if(active) afterActive = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
Printf(true, " %Fl%Ls%fshow all%E / %Fl%Lh%fhide all%E",
|
|
|
|
&(TextWindow::ScreenShowGroupsSpecial),
|
|
|
|
&(TextWindow::ScreenShowGroupsSpecial));
|
2010-01-04 00:35:28 +00:00
|
|
|
Printf(true, " %Fl%Ls%fline styles%E /"
|
|
|
|
" %Fl%Ls%fview%E /"
|
|
|
|
" %Fl%Ls%fconfiguration%E",
|
2009-09-18 08:14:15 +00:00
|
|
|
&(TextWindow::ScreenShowListOfStyles),
|
2010-01-04 00:35:28 +00:00
|
|
|
&(TextWindow::ScreenShowEditView),
|
2008-06-23 08:37:12 +00:00
|
|
|
&(TextWindow::ScreenShowConfiguration));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// The screen that shows information about a specific group, and allows the
|
|
|
|
// user to edit various things about it.
|
|
|
|
//-----------------------------------------------------------------------------
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenHoverConstraint(int link, uint32_t v) {
|
2008-06-23 08:37:12 +00:00
|
|
|
if(!SS.GW.showConstraints) return;
|
|
|
|
|
|
|
|
hConstraint hc = { v };
|
2009-04-19 05:53:16 +00:00
|
|
|
Constraint *c = SK.GetConstraint(hc);
|
2008-06-23 08:37:12 +00:00
|
|
|
if(c->group.v != SS.GW.activeGroup.v) {
|
|
|
|
// Only constraints in the active group are visible
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
SS.GW.hover.Clear();
|
|
|
|
SS.GW.hover.constraint = hc;
|
|
|
|
SS.GW.hover.emphasized = true;
|
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenHoverRequest(int link, uint32_t v) {
|
2008-06-23 08:37:12 +00:00
|
|
|
SS.GW.hover.Clear();
|
|
|
|
hRequest hr = { v };
|
|
|
|
SS.GW.hover.entity = hr.entity(0);
|
|
|
|
SS.GW.hover.emphasized = true;
|
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenSelectConstraint(int link, uint32_t v) {
|
2008-06-23 08:37:12 +00:00
|
|
|
SS.GW.ClearSelection();
|
2009-11-03 18:54:49 +00:00
|
|
|
GraphicsWindow::Selection sel;
|
|
|
|
ZERO(&sel);
|
|
|
|
sel.constraint.v = v;
|
|
|
|
SS.GW.selection.Add(&sel);
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenSelectRequest(int link, uint32_t v) {
|
2008-06-23 08:37:12 +00:00
|
|
|
SS.GW.ClearSelection();
|
2009-11-03 18:54:49 +00:00
|
|
|
GraphicsWindow::Selection sel;
|
|
|
|
ZERO(&sel);
|
|
|
|
hRequest hr = { v };
|
|
|
|
sel.entity = hr.entity(0);
|
|
|
|
SS.GW.selection.Add(&sel);
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeGroupOption(int link, uint32_t v) {
|
2008-06-23 08:37:12 +00:00
|
|
|
SS.UndoRemember();
|
2009-04-19 05:53:16 +00:00
|
|
|
Group *g = SK.GetGroup(SS.TW.shown.group);
|
2008-06-23 08:37:12 +00:00
|
|
|
|
2009-10-09 12:57:10 +00:00
|
|
|
switch(link) {
|
2010-05-09 18:25:23 +00:00
|
|
|
case 's': g->subtype = Group::ONE_SIDED; break;
|
|
|
|
case 'S': g->subtype = Group::TWO_SIDED; break;
|
2009-05-22 10:02:02 +00:00
|
|
|
|
2010-05-09 18:25:23 +00:00
|
|
|
case 'k': g->skipFirst = true; break;
|
|
|
|
case 'K': g->skipFirst = false; break;
|
2009-10-09 12:57:10 +00:00
|
|
|
|
2010-05-09 18:25:23 +00:00
|
|
|
case 'c': g->meshCombine = v; break;
|
2009-10-09 12:57:10 +00:00
|
|
|
|
2010-05-09 18:25:23 +00:00
|
|
|
case 'P': g->suppress = !(g->suppress); break;
|
2009-10-09 12:57:10 +00:00
|
|
|
|
2010-05-09 18:25:23 +00:00
|
|
|
case 'r': g->relaxConstraints = !(g->relaxConstraints); break;
|
2009-10-09 12:57:10 +00:00
|
|
|
|
2010-05-12 04:57:41 +00:00
|
|
|
case 'v': g->visible = !(g->visible); break;
|
|
|
|
|
2010-05-10 01:06:09 +00:00
|
|
|
case 'd': g->allDimsReference = !(g->allDimsReference); break;
|
|
|
|
|
2010-05-09 18:25:23 +00:00
|
|
|
case 'f': g->forceToMesh = !(g->forceToMesh); break;
|
2009-10-09 12:57:10 +00:00
|
|
|
}
|
2008-02-15 11:35:15 +00:00
|
|
|
|
|
|
|
SS.MarkGroupDirty(g->h);
|
|
|
|
SS.GenerateAll();
|
|
|
|
SS.GW.ClearSuper();
|
|
|
|
}
|
2009-10-01 11:22:56 +00:00
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenColor(int link, uint32_t v) {
|
2008-06-23 08:37:12 +00:00
|
|
|
SS.UndoRemember();
|
|
|
|
|
2009-04-19 05:53:16 +00:00
|
|
|
Group *g = SK.GetGroup(SS.TW.shown.group);
|
2010-08-14 19:00:25 +00:00
|
|
|
SS.TW.ShowEditControlWithColorPicker(v, 3, g->color);
|
|
|
|
SS.TW.edit.meaning = EDIT_GROUP_COLOR;
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeExprA(int link, uint32_t v) {
|
2009-04-19 05:53:16 +00:00
|
|
|
Group *g = SK.GetGroup(SS.TW.shown.group);
|
2008-06-23 08:37:12 +00:00
|
|
|
|
|
|
|
// There's an extra line for the skipFirst parameter in one-sided groups.
|
2010-05-09 18:25:23 +00:00
|
|
|
int r = (g->subtype == Group::ONE_SIDED) ? 16 : 14;
|
2008-06-23 08:37:12 +00:00
|
|
|
|
|
|
|
char str[1024];
|
|
|
|
sprintf(str, "%d", (int)g->valA);
|
2010-07-12 07:51:12 +00:00
|
|
|
SS.TW.ShowEditControl(r, 10, str);
|
2008-06-23 08:37:12 +00:00
|
|
|
SS.TW.edit.meaning = EDIT_TIMES_REPEATED;
|
|
|
|
SS.TW.edit.group.v = v;
|
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeGroupName(int link, uint32_t v) {
|
2009-04-19 05:53:16 +00:00
|
|
|
Group *g = SK.GetGroup(SS.TW.shown.group);
|
2010-07-12 07:51:12 +00:00
|
|
|
SS.TW.ShowEditControl(7, 12, g->DescriptionString()+5);
|
2008-06-23 08:37:12 +00:00
|
|
|
SS.TW.edit.meaning = EDIT_GROUP_NAME;
|
|
|
|
SS.TW.edit.group.v = v;
|
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeGroupScale(int link, uint32_t v) {
|
2009-12-15 12:26:22 +00:00
|
|
|
Group *g = SK.GetGroup(SS.TW.shown.group);
|
|
|
|
|
|
|
|
char str[1024];
|
|
|
|
sprintf(str, "%.3f", g->scale);
|
2010-07-12 07:51:12 +00:00
|
|
|
SS.TW.ShowEditControl(14, 13, str);
|
2009-12-15 12:26:22 +00:00
|
|
|
SS.TW.edit.meaning = EDIT_GROUP_SCALE;
|
|
|
|
SS.TW.edit.group.v = v;
|
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenDeleteGroup(int link, uint32_t v) {
|
2008-06-23 08:37:12 +00:00
|
|
|
SS.UndoRemember();
|
|
|
|
|
2008-07-10 06:11:56 +00:00
|
|
|
hGroup hg = SS.TW.shown.group;
|
2008-06-23 08:37:12 +00:00
|
|
|
if(hg.v == SS.GW.activeGroup.v) {
|
|
|
|
Error("This group is currently active; activate a different group "
|
|
|
|
"before proceeding.");
|
|
|
|
return;
|
|
|
|
}
|
2009-04-19 05:53:16 +00:00
|
|
|
SK.group.RemoveById(SS.TW.shown.group);
|
2008-06-23 08:37:12 +00:00
|
|
|
// This is a major change, so let's re-solve everything.
|
|
|
|
SS.TW.ClearSuper();
|
|
|
|
SS.GW.ClearSuper();
|
|
|
|
SS.GenerateAll(0, INT_MAX);
|
|
|
|
}
|
|
|
|
void TextWindow::ShowGroupInfo(void) {
|
2009-04-19 05:53:16 +00:00
|
|
|
Group *g = SK.group.FindById(shown.group);
|
2013-08-26 18:58:35 +00:00
|
|
|
const char *s = "???";
|
2008-06-23 08:37:12 +00:00
|
|
|
|
2008-07-10 06:11:56 +00:00
|
|
|
if(shown.group.v == Group::HGROUP_REFERENCES.v) {
|
2010-05-09 18:25:23 +00:00
|
|
|
Printf(true, "%FtGROUP %E%s", g->DescriptionString());
|
|
|
|
goto list_items;
|
2008-06-23 08:37:12 +00:00
|
|
|
} else {
|
2010-05-09 18:25:23 +00:00
|
|
|
Printf(true, "%FtGROUP %E%s [%Fl%Ll%D%frename%E/%Fl%Ll%D%fdel%E]",
|
2008-06-23 08:37:12 +00:00
|
|
|
g->DescriptionString(),
|
|
|
|
g->h.v, &TextWindow::ScreenChangeGroupName,
|
|
|
|
g->h.v, &TextWindow::ScreenDeleteGroup);
|
|
|
|
}
|
|
|
|
|
2010-05-09 18:25:23 +00:00
|
|
|
if(g->type == Group::LATHE) {
|
|
|
|
Printf(true, " %Ftlathe plane sketch");
|
|
|
|
} else if(g->type == Group::EXTRUDE || g->type == Group::ROTATE ||
|
|
|
|
g->type == Group::TRANSLATE)
|
2008-06-23 08:37:12 +00:00
|
|
|
{
|
2010-05-09 18:25:23 +00:00
|
|
|
if(g->type == Group::EXTRUDE) {
|
|
|
|
s = "extrude plane sketch";
|
|
|
|
} else if(g->type == Group::TRANSLATE) {
|
|
|
|
s = "translate original sketch";
|
|
|
|
} else if(g->type == Group::ROTATE) {
|
|
|
|
s = "rotate original sketch";
|
|
|
|
}
|
|
|
|
Printf(true, " %Ft%s%E", s);
|
|
|
|
|
2008-06-23 08:37:12 +00:00
|
|
|
bool one = (g->subtype == Group::ONE_SIDED);
|
2010-05-09 18:25:23 +00:00
|
|
|
Printf(false,
|
|
|
|
"%Ba %f%Ls%Fd%c one-sided%E "
|
|
|
|
"%f%LS%Fd%c two-sided%E",
|
2009-10-09 12:57:10 +00:00
|
|
|
&TextWindow::ScreenChangeGroupOption,
|
2010-05-09 18:25:23 +00:00
|
|
|
one ? RADIO_TRUE : RADIO_FALSE,
|
2009-10-09 12:57:10 +00:00
|
|
|
&TextWindow::ScreenChangeGroupOption,
|
2010-05-09 18:25:23 +00:00
|
|
|
!one ? RADIO_TRUE : RADIO_FALSE);
|
2008-06-23 08:37:12 +00:00
|
|
|
|
2010-05-09 18:25:23 +00:00
|
|
|
if(g->type == Group::ROTATE || g->type == Group::TRANSLATE) {
|
|
|
|
if(g->subtype == Group::ONE_SIDED) {
|
|
|
|
bool skip = g->skipFirst;
|
2015-03-29 00:30:52 +00:00
|
|
|
Printf(false,
|
2010-05-09 18:25:23 +00:00
|
|
|
"%Bd %Ftstart %f%LK%Fd%c with original%E "
|
|
|
|
"%f%Lk%Fd%c with copy #1%E",
|
|
|
|
&ScreenChangeGroupOption,
|
|
|
|
!skip ? RADIO_TRUE : RADIO_FALSE,
|
|
|
|
&ScreenChangeGroupOption,
|
|
|
|
skip ? RADIO_TRUE : RADIO_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
int times = (int)(g->valA);
|
|
|
|
Printf(false, "%Bp %Ftrepeat%E %d time%s %Fl%Ll%D%f[change]%E",
|
|
|
|
(g->subtype == Group::ONE_SIDED) ? 'a' : 'd',
|
|
|
|
times, times == 1 ? "" : "s",
|
|
|
|
g->h.v, &TextWindow::ScreenChangeExprA);
|
|
|
|
}
|
|
|
|
} else if(g->type == Group::IMPORTED) {
|
|
|
|
Printf(true, " %Ftimport geometry from file%E");
|
|
|
|
Printf(false, "%Ba '%s'", g->impFileRel);
|
|
|
|
Printf(false, "%Bd %Ftscaled by%E %# %Fl%Ll%f%D[change]%E",
|
|
|
|
g->scale,
|
|
|
|
&TextWindow::ScreenChangeGroupScale, g->h.v);
|
|
|
|
} else if(g->type == Group::DRAWING_3D) {
|
|
|
|
Printf(true, " %Ftsketch in 3d%E");
|
|
|
|
} else if(g->type == Group::DRAWING_WORKPLANE) {
|
|
|
|
Printf(true, " %Ftsketch in new workplane%E");
|
|
|
|
} else {
|
|
|
|
Printf(true, "???");
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
2010-05-09 18:25:23 +00:00
|
|
|
Printf(false, "");
|
2008-06-23 08:37:12 +00:00
|
|
|
|
|
|
|
if(g->type == Group::EXTRUDE ||
|
|
|
|
g->type == Group::LATHE ||
|
|
|
|
g->type == Group::IMPORTED)
|
|
|
|
{
|
|
|
|
bool un = (g->meshCombine == Group::COMBINE_AS_UNION);
|
|
|
|
bool diff = (g->meshCombine == Group::COMBINE_AS_DIFFERENCE);
|
|
|
|
bool asy = (g->meshCombine == Group::COMBINE_AS_ASSEMBLE);
|
|
|
|
bool asa = (g->type == Group::IMPORTED);
|
|
|
|
|
2010-05-09 18:25:23 +00:00
|
|
|
Printf(false, " %Ftsolid model as");
|
|
|
|
Printf(false, "%Ba %f%D%Lc%Fd%c union%E "
|
|
|
|
"%f%D%Lc%Fd%c difference%E "
|
|
|
|
"%f%D%Lc%Fd%c%s%E ",
|
2009-10-09 12:57:10 +00:00
|
|
|
&TextWindow::ScreenChangeGroupOption,
|
2008-06-23 08:37:12 +00:00
|
|
|
Group::COMBINE_AS_UNION,
|
2010-05-09 18:25:23 +00:00
|
|
|
un ? RADIO_TRUE : RADIO_FALSE,
|
2009-10-09 12:57:10 +00:00
|
|
|
&TextWindow::ScreenChangeGroupOption,
|
2008-06-23 08:37:12 +00:00
|
|
|
Group::COMBINE_AS_DIFFERENCE,
|
2010-05-09 18:25:23 +00:00
|
|
|
diff ? RADIO_TRUE : RADIO_FALSE,
|
2009-10-09 12:57:10 +00:00
|
|
|
&TextWindow::ScreenChangeGroupOption,
|
2008-06-23 08:37:12 +00:00
|
|
|
Group::COMBINE_AS_ASSEMBLE,
|
2010-05-09 18:25:23 +00:00
|
|
|
asa ? (asy ? RADIO_TRUE : RADIO_FALSE) : 0,
|
|
|
|
asa ? " assemble" : "");
|
2009-10-01 11:22:56 +00:00
|
|
|
|
2010-05-09 18:25:23 +00:00
|
|
|
if(g->type == Group::EXTRUDE ||
|
|
|
|
g->type == Group::LATHE)
|
|
|
|
{
|
2010-08-14 19:00:25 +00:00
|
|
|
Printf(false,
|
Replaced RGB-color integers with dedicated data structure
RGB colors were represented using a uint32_t with the red, green and blue
values stuffed into the lower three octets (i.e. 0x00BBGGRR), like
Microsoft's COLORREF. This approach did not lend itself to type safety,
however, so this change replaces it with an RgbColor class that provides
the same infomation plus a handful of useful methods to work with it. (Note
that sizeof(RgbColor) == sizeof(uint32_t), so this change should not lead
to memory bloat.)
Some of the new methods/fields replace what were previously macro calls;
e.g. RED(c) is now c.red, REDf(c) is now c.redF(). The .Equals() method is
now used instead of == to compare colors.
RGB colors still need to be represented as packed integers in file I/O and
preferences, so the methods .FromPackedInt() and .ToPackedInt() are
provided. Also implemented are Cnf{Freeze,Thaw}Color(), type-safe wrappers
around Cnf{Freeze,Thaw}Int() that facilitate I/O with preferences.
(Cnf{Freeze,Thaw}Color() are defined outside of the system-dependent code
to minimize the footprint of the latter; because the same can be done with
Cnf{Freeze,Thaw}Bool(), those are also moved out of the system code with
this commit.)
Color integers were being OR'ed with 0x80000000 in some places for two
distinct purposes: One, to indicate use of a default color in
glxFillMesh(); this has been replaced by use of the .UseDefault() method.
Two, to indicate to TextWindow::Printf() that the format argument of a
"%Bp"/"%Fp" specifier is an RGB color rather than a color "code" from
TextWindow::bgColors[] or TextWindow::fgColors[] (as the specifier can
accept either); instead, we define a new flag "z" (as in "%Bz" or "%Fz") to
indicate an RGBcolor pointer, leaving "%Bp"/"%Fp" to indicate a color code
exclusively.
(This also allows TextWindow::meta[][].bg to be a char instead of an int,
partly compensating for the new .bgRgb field added immediately after.)
In array declarations, RGB colors could previously be specified as 0 (often
in a terminating element). As that no longer works, we define NULL_COLOR,
which serves much the same purpose for RgbColor variables as NULL serves
for pointers.
2013-10-16 20:00:58 +00:00
|
|
|
"%Bd %Ftcolor %E%Bz %Bd (%@, %@, %@) %f%D%Lf%Fl[change]%E",
|
|
|
|
&g->color,
|
|
|
|
g->color.redF(), g->color.greenF(), g->color.blueF(),
|
2010-08-14 19:00:25 +00:00
|
|
|
ScreenColor, top[rows-1] + 2);
|
2010-05-09 18:25:23 +00:00
|
|
|
} else if(g->type == Group::IMPORTED) {
|
|
|
|
bool sup = g->suppress;
|
|
|
|
Printf(false, " %Fd%f%LP%c suppress this group's solid model",
|
|
|
|
&TextWindow::ScreenChangeGroupOption,
|
|
|
|
g->suppress ? CHECK_TRUE : CHECK_FALSE);
|
2009-05-22 10:02:02 +00:00
|
|
|
}
|
2009-05-30 08:49:09 +00:00
|
|
|
|
2010-05-09 18:25:23 +00:00
|
|
|
Printf(false, "");
|
2009-05-22 10:02:02 +00:00
|
|
|
}
|
|
|
|
|
2010-05-12 04:57:41 +00:00
|
|
|
Printf(false, " %f%Lv%Fd%c show entities from this group",
|
|
|
|
&TextWindow::ScreenChangeGroupOption,
|
|
|
|
g->visible ? CHECK_TRUE : CHECK_FALSE);
|
|
|
|
|
2013-08-26 19:08:16 +00:00
|
|
|
Group *pg; pg = g->PreviousGroup();
|
2010-05-09 18:25:23 +00:00
|
|
|
if(pg && pg->runningMesh.IsEmpty() && g->thisMesh.IsEmpty()) {
|
|
|
|
Printf(false, " %f%Lf%Fd%c force NURBS surfaces to triangle mesh",
|
|
|
|
&TextWindow::ScreenChangeGroupOption,
|
|
|
|
g->forceToMesh ? CHECK_TRUE : CHECK_FALSE);
|
2008-06-23 08:37:12 +00:00
|
|
|
} else {
|
2010-05-09 18:25:23 +00:00
|
|
|
Printf(false, " (model already forced to triangle mesh)");
|
|
|
|
}
|
|
|
|
|
2010-05-10 01:06:09 +00:00
|
|
|
Printf(true, " %f%Lr%Fd%c relax constraints and dimensions",
|
2010-05-09 18:25:23 +00:00
|
|
|
&TextWindow::ScreenChangeGroupOption,
|
|
|
|
g->relaxConstraints ? CHECK_TRUE : CHECK_FALSE);
|
|
|
|
|
2010-05-10 01:06:09 +00:00
|
|
|
Printf(false, " %f%Ld%Fd%c treat all dimensions as reference",
|
|
|
|
&TextWindow::ScreenChangeGroupOption,
|
|
|
|
g->allDimsReference ? CHECK_TRUE : CHECK_FALSE);
|
|
|
|
|
2010-05-09 18:25:23 +00:00
|
|
|
if(g->booleanFailed) {
|
2008-06-23 08:37:12 +00:00
|
|
|
Printf(false, "");
|
2010-05-09 18:25:23 +00:00
|
|
|
Printf(false, "The Boolean operation failed. It may be ");
|
|
|
|
Printf(false, "possible to fix the problem by choosing ");
|
|
|
|
Printf(false, "'force NURBS surfaces to triangle mesh'.");
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
|
|
|
|
2010-05-09 18:25:23 +00:00
|
|
|
list_items:
|
|
|
|
Printf(false, "");
|
|
|
|
Printf(false, "%Ft requests in group");
|
|
|
|
|
2008-06-23 08:37:12 +00:00
|
|
|
int i, a = 0;
|
2009-04-19 05:53:16 +00:00
|
|
|
for(i = 0; i < SK.request.n; i++) {
|
|
|
|
Request *r = &(SK.request.elem[i]);
|
2008-06-23 08:37:12 +00:00
|
|
|
|
2008-07-10 06:11:56 +00:00
|
|
|
if(r->group.v == shown.group.v) {
|
2008-06-23 08:37:12 +00:00
|
|
|
char *s = r->DescriptionString();
|
|
|
|
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E",
|
|
|
|
(a & 1) ? 'd' : 'a',
|
|
|
|
r->h.v, (&TextWindow::ScreenSelectRequest),
|
|
|
|
&(TextWindow::ScreenHoverRequest), s);
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(a == 0) Printf(false, "%Ba (none)");
|
|
|
|
|
|
|
|
a = 0;
|
2010-05-09 18:25:23 +00:00
|
|
|
Printf(false, "");
|
|
|
|
Printf(false, "%Ft constraints in group (%d DOF)", g->solved.dof);
|
2009-04-19 05:53:16 +00:00
|
|
|
for(i = 0; i < SK.constraint.n; i++) {
|
|
|
|
Constraint *c = &(SK.constraint.elem[i]);
|
2008-06-23 08:37:12 +00:00
|
|
|
|
2008-07-10 06:11:56 +00:00
|
|
|
if(c->group.v == shown.group.v) {
|
2008-06-23 08:37:12 +00:00
|
|
|
char *s = c->DescriptionString();
|
2008-07-02 06:59:49 +00:00
|
|
|
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E %s",
|
2008-06-23 08:37:12 +00:00
|
|
|
(a & 1) ? 'd' : 'a',
|
|
|
|
c->h.v, (&TextWindow::ScreenSelectConstraint),
|
2008-07-02 06:59:49 +00:00
|
|
|
(&TextWindow::ScreenHoverConstraint), s,
|
|
|
|
c->reference ? "(ref)" : "");
|
2008-06-23 08:37:12 +00:00
|
|
|
a++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(a == 0) Printf(false, "%Ba (none)");
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// The screen that's displayed when the sketch fails to solve. A report of
|
|
|
|
// what failed, and (if the problem is a singular Jacobian) a list of
|
|
|
|
// constraints that could be removed to fix it.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void TextWindow::ShowGroupSolveInfo(void) {
|
2009-04-19 05:53:16 +00:00
|
|
|
Group *g = SK.group.FindById(shown.group);
|
2009-04-20 07:30:09 +00:00
|
|
|
if(g->solved.how == System::SOLVED_OKAY) {
|
2008-06-23 08:37:12 +00:00
|
|
|
// Go back to the default group info screen
|
2008-07-10 06:11:56 +00:00
|
|
|
shown.screen = SCREEN_GROUP_INFO;
|
2008-06-23 08:37:12 +00:00
|
|
|
Show();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Printf(true, "%FtGROUP %E%s", g->DescriptionString());
|
|
|
|
switch(g->solved.how) {
|
2009-04-20 07:30:09 +00:00
|
|
|
case System::DIDNT_CONVERGE:
|
2008-09-05 11:25:53 +00:00
|
|
|
Printf(true, "%FxSOLVE FAILED!%Fd no convergence");
|
|
|
|
Printf(true, "the following constraints are unsatisfied");
|
2008-06-23 08:37:12 +00:00
|
|
|
break;
|
|
|
|
|
2009-04-20 07:30:09 +00:00
|
|
|
case System::SINGULAR_JACOBIAN:
|
2008-06-23 08:37:12 +00:00
|
|
|
Printf(true, "%FxSOLVE FAILED!%Fd inconsistent system");
|
|
|
|
Printf(true, "remove any one of these to fix it");
|
|
|
|
break;
|
2009-04-19 20:37:51 +00:00
|
|
|
|
2009-04-20 07:30:09 +00:00
|
|
|
case System::TOO_MANY_UNKNOWNS:
|
2009-04-19 20:37:51 +00:00
|
|
|
Printf(true, "Too many unknowns in a single group!");
|
|
|
|
return;
|
2008-09-05 11:25:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for(int i = 0; i < g->solved.remove.n; i++) {
|
|
|
|
hConstraint hc = g->solved.remove.elem[i];
|
2009-04-19 05:53:16 +00:00
|
|
|
Constraint *c = SK.constraint.FindByIdNoOops(hc);
|
2008-09-05 11:25:53 +00:00
|
|
|
if(!c) continue;
|
|
|
|
|
|
|
|
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E",
|
|
|
|
(i & 1) ? 'd' : 'a',
|
|
|
|
c->h.v, (&TextWindow::ScreenSelectConstraint),
|
|
|
|
(&TextWindow::ScreenHoverConstraint),
|
|
|
|
c->DescriptionString());
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
2008-07-10 07:17:35 +00:00
|
|
|
|
|
|
|
Printf(true, "It may be possible to fix the problem ");
|
|
|
|
Printf(false, "by selecting Edit -> Undo.");
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
|
|
|
|
2008-07-20 11:27:22 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// When we're stepping a dimension. User specifies the finish value, and
|
|
|
|
// how many steps to take in between current and finish, re-solving each
|
|
|
|
// time.
|
|
|
|
//-----------------------------------------------------------------------------
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenStepDimFinish(int link, uint32_t v) {
|
2008-07-20 11:27:22 +00:00
|
|
|
SS.TW.edit.meaning = EDIT_STEP_DIM_FINISH;
|
|
|
|
char s[1024];
|
|
|
|
if(SS.TW.shown.dimIsDistance) {
|
|
|
|
strcpy(s, SS.MmToString(SS.TW.shown.dimFinish));
|
|
|
|
} else {
|
|
|
|
sprintf(s, "%.3f", SS.TW.shown.dimFinish);
|
|
|
|
}
|
2010-07-12 07:51:12 +00:00
|
|
|
SS.TW.ShowEditControl(12, 12, s);
|
2008-07-20 11:27:22 +00:00
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenStepDimSteps(int link, uint32_t v) {
|
2008-07-20 11:27:22 +00:00
|
|
|
char str[1024];
|
|
|
|
sprintf(str, "%d", SS.TW.shown.dimSteps);
|
|
|
|
SS.TW.edit.meaning = EDIT_STEP_DIM_STEPS;
|
2010-07-12 07:51:12 +00:00
|
|
|
SS.TW.ShowEditControl(14, 12, str);
|
2008-07-20 11:27:22 +00:00
|
|
|
}
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenStepDimGo(int link, uint32_t v) {
|
2008-07-20 11:27:22 +00:00
|
|
|
hConstraint hc = SS.TW.shown.constraint;
|
2009-04-19 05:53:16 +00:00
|
|
|
Constraint *c = SK.constraint.FindByIdNoOops(hc);
|
2008-07-20 11:27:22 +00:00
|
|
|
if(c) {
|
|
|
|
SS.UndoRemember();
|
|
|
|
double start = c->valA, finish = SS.TW.shown.dimFinish;
|
|
|
|
int i, n = SS.TW.shown.dimSteps;
|
|
|
|
for(i = 1; i <= n; i++) {
|
2009-04-19 05:53:16 +00:00
|
|
|
c = SK.GetConstraint(hc);
|
2008-07-20 11:27:22 +00:00
|
|
|
c->valA = start + ((finish - start)*i)/n;
|
|
|
|
SS.MarkGroupDirty(c->group);
|
|
|
|
SS.GenerateAll();
|
|
|
|
if(!SS.AllGroupsOkay()) {
|
|
|
|
// Failed to solve, so quit
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
PaintGraphics();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
InvalidateGraphics();
|
|
|
|
SS.TW.GoToScreen(SCREEN_LIST_OF_GROUPS);
|
|
|
|
}
|
|
|
|
void TextWindow::ShowStepDimension(void) {
|
2009-04-19 05:53:16 +00:00
|
|
|
Constraint *c = SK.constraint.FindByIdNoOops(shown.constraint);
|
2008-07-20 11:27:22 +00:00
|
|
|
if(!c) {
|
|
|
|
shown.screen = SCREEN_LIST_OF_GROUPS;
|
|
|
|
Show();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Printf(true, "%FtSTEP DIMENSION%E %s", c->DescriptionString());
|
|
|
|
|
|
|
|
if(shown.dimIsDistance) {
|
2010-05-09 18:25:23 +00:00
|
|
|
Printf(true, "%Ba %Ftstart%E %s", SS.MmToString(c->valA));
|
|
|
|
Printf(false, "%Bd %Ftfinish%E %s %Fl%Ll%f[change]%E",
|
2008-07-20 11:27:22 +00:00
|
|
|
SS.MmToString(shown.dimFinish), &ScreenStepDimFinish);
|
|
|
|
} else {
|
2010-05-09 18:25:23 +00:00
|
|
|
Printf(true, "%Ba %Ftstart%E %@", c->valA);
|
|
|
|
Printf(false, "%Bd %Ftfinish%E %@ %Fl%Ll%f[change]%E",
|
2008-07-20 11:27:22 +00:00
|
|
|
shown.dimFinish, &ScreenStepDimFinish);
|
|
|
|
}
|
2010-05-09 18:25:23 +00:00
|
|
|
Printf(false, "%Ba %Ftsteps%E %d %Fl%Ll%f%D[change]%E",
|
2008-07-20 11:27:22 +00:00
|
|
|
shown.dimSteps, &ScreenStepDimSteps);
|
|
|
|
|
|
|
|
Printf(true, " %Fl%Ll%fstep dimension now%E", &ScreenStepDimGo);
|
|
|
|
|
|
|
|
Printf(true, "(or %Fl%Ll%fcancel operation%E)", &ScreenHome);
|
|
|
|
}
|
|
|
|
|
2010-05-16 16:36:23 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// When we're creating tangent arcs (as requests, not as some parametric
|
|
|
|
// thing). User gets to specify the radius, and whether the old untrimmed
|
|
|
|
// curves are kept or deleted.
|
|
|
|
//-----------------------------------------------------------------------------
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeTangentArc(int link, uint32_t v) {
|
2010-05-16 16:36:23 +00:00
|
|
|
switch(link) {
|
|
|
|
case 'r': {
|
|
|
|
char str[1024];
|
|
|
|
strcpy(str, SS.MmToString(SS.tangentArcRadius));
|
|
|
|
SS.TW.edit.meaning = EDIT_TANGENT_ARC_RADIUS;
|
2010-07-12 07:51:12 +00:00
|
|
|
SS.TW.ShowEditControl(12, 3, str);
|
2010-05-16 16:36:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 'a': SS.tangentArcManual = !SS.tangentArcManual; break;
|
|
|
|
case 'd': SS.tangentArcDeleteOld = !SS.tangentArcDeleteOld; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void TextWindow::ShowTangentArc(void) {
|
|
|
|
Printf(true, "%FtTANGENT ARC PARAMETERS%E");
|
|
|
|
|
|
|
|
Printf(true, "%Ft radius of created arc%E");
|
|
|
|
if(SS.tangentArcManual) {
|
|
|
|
Printf(false, "%Ba %s %Fl%Lr%f[change]%E",
|
|
|
|
SS.MmToString(SS.tangentArcRadius),
|
|
|
|
&(TextWindow::ScreenChangeTangentArc));
|
|
|
|
} else {
|
|
|
|
Printf(false, "%Ba automatic");
|
|
|
|
}
|
|
|
|
|
|
|
|
Printf(false, "");
|
|
|
|
Printf(false, " %Fd%f%La%c choose radius automatically%E",
|
|
|
|
&ScreenChangeTangentArc,
|
|
|
|
!SS.tangentArcManual ? CHECK_TRUE : CHECK_FALSE);
|
|
|
|
Printf(false, " %Fd%f%Ld%c delete original entities afterward%E",
|
|
|
|
&ScreenChangeTangentArc,
|
|
|
|
SS.tangentArcDeleteOld ? CHECK_TRUE : CHECK_FALSE);
|
|
|
|
|
|
|
|
Printf(false, "");
|
|
|
|
Printf(false, "To create a tangent arc at a point,");
|
|
|
|
Printf(false, "select that point and then choose");
|
|
|
|
Printf(false, "Sketch -> Tangent Arc at Point.");
|
2010-05-17 01:54:19 +00:00
|
|
|
Printf(true, "(or %Fl%Ll%fback to home screen%E)", &ScreenHome);
|
2010-05-16 16:36:23 +00:00
|
|
|
}
|
|
|
|
|
2008-06-23 08:37:12 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// The edit control is visible, and the user just pressed enter.
|
|
|
|
//-----------------------------------------------------------------------------
|
2013-09-16 19:51:20 +00:00
|
|
|
void TextWindow::EditControlDone(const char *s) {
|
2010-01-04 00:35:28 +00:00
|
|
|
edit.showAgain = false;
|
|
|
|
|
2008-06-23 08:37:12 +00:00
|
|
|
switch(edit.meaning) {
|
|
|
|
case EDIT_TIMES_REPEATED: {
|
2010-01-04 00:35:28 +00:00
|
|
|
Expr *e = Expr::From(s, true);
|
2008-06-23 08:37:12 +00:00
|
|
|
if(e) {
|
|
|
|
SS.UndoRemember();
|
|
|
|
|
2008-07-09 06:13:49 +00:00
|
|
|
double ev = e->Eval();
|
|
|
|
if((int)ev < 1) {
|
|
|
|
Error("Can't repeat fewer than 1 time.");
|
|
|
|
break;
|
|
|
|
}
|
2010-09-18 02:20:08 +00:00
|
|
|
if((int)ev > 999) {
|
|
|
|
Error("Can't repeat more than 999 times.");
|
|
|
|
break;
|
|
|
|
}
|
2008-07-09 06:13:49 +00:00
|
|
|
|
2009-04-19 05:53:16 +00:00
|
|
|
Group *g = SK.GetGroup(edit.group);
|
2008-07-09 06:13:49 +00:00
|
|
|
g->valA = ev;
|
|
|
|
|
|
|
|
if(g->type == Group::ROTATE) {
|
|
|
|
int i, c = 0;
|
2009-04-19 05:53:16 +00:00
|
|
|
for(i = 0; i < SK.constraint.n; i++) {
|
|
|
|
if(SK.constraint.elem[i].group.v == g->h.v) c++;
|
2008-07-09 06:13:49 +00:00
|
|
|
}
|
|
|
|
// If the group does not contain any constraints, then
|
|
|
|
// set the numerical guess to space the copies uniformly
|
|
|
|
// over one rotation. Don't touch the guess if we're
|
|
|
|
// already constrained, because that would break
|
|
|
|
// convergence.
|
|
|
|
if(c == 0) {
|
2009-09-18 08:14:15 +00:00
|
|
|
double copies = (g->skipFirst) ? (ev + 1) : ev;
|
|
|
|
SK.GetParam(g->h.param(3))->val = PI/(2*copies);
|
2008-07-09 06:13:49 +00:00
|
|
|
}
|
|
|
|
}
|
2008-06-23 08:37:12 +00:00
|
|
|
|
|
|
|
SS.MarkGroupDirty(g->h);
|
2015-03-18 17:02:11 +00:00
|
|
|
SS.ScheduleGenerateAll();
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDIT_GROUP_NAME: {
|
2009-09-18 08:14:15 +00:00
|
|
|
if(!StringAllPrintable(s) || !*s) {
|
2008-06-23 08:37:12 +00:00
|
|
|
Error("Invalid characters. Allowed are: A-Z a-z 0-9 _ -");
|
|
|
|
} else {
|
|
|
|
SS.UndoRemember();
|
|
|
|
|
2009-04-19 05:53:16 +00:00
|
|
|
Group *g = SK.GetGroup(edit.group);
|
2008-06-23 08:37:12 +00:00
|
|
|
g->name.strcpy(s);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2009-12-15 12:26:22 +00:00
|
|
|
case EDIT_GROUP_SCALE: {
|
2010-01-04 00:35:28 +00:00
|
|
|
Expr *e = Expr::From(s, true);
|
2009-12-15 12:26:22 +00:00
|
|
|
if(e) {
|
|
|
|
double ev = e->Eval();
|
|
|
|
if(fabs(ev) < 1e-6) {
|
|
|
|
Error("Scale cannot be zero.");
|
|
|
|
} else {
|
|
|
|
Group *g = SK.GetGroup(edit.group);
|
|
|
|
g->scale = ev;
|
|
|
|
SS.MarkGroupDirty(g->h);
|
2015-03-18 17:02:11 +00:00
|
|
|
SS.ScheduleGenerateAll();
|
2009-12-15 12:26:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2010-08-14 19:00:25 +00:00
|
|
|
case EDIT_GROUP_COLOR: {
|
|
|
|
Vector rgb;
|
|
|
|
if(sscanf(s, "%lf, %lf, %lf", &rgb.x, &rgb.y, &rgb.z)==3) {
|
|
|
|
rgb = rgb.ClampWithin(0, 1);
|
|
|
|
|
|
|
|
Group *g = SK.group.FindByIdNoOops(SS.TW.shown.group);
|
|
|
|
if(!g) break;
|
|
|
|
g->color = RGBf(rgb.x, rgb.y, rgb.z);
|
|
|
|
|
|
|
|
SS.MarkGroupDirty(g->h);
|
2015-03-18 17:02:11 +00:00
|
|
|
SS.ScheduleGenerateAll();
|
2010-08-14 19:00:25 +00:00
|
|
|
SS.GW.ClearSuper();
|
|
|
|
} else {
|
|
|
|
Error("Bad format: specify color as r, g, b");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2008-06-30 09:09:17 +00:00
|
|
|
case EDIT_TTF_TEXT: {
|
|
|
|
SS.UndoRemember();
|
2009-04-19 05:53:16 +00:00
|
|
|
Request *r = SK.request.FindByIdNoOops(edit.request);
|
2008-06-30 09:09:17 +00:00
|
|
|
if(r) {
|
|
|
|
r->str.strcpy(s);
|
|
|
|
SS.MarkGroupDirty(r->group);
|
2015-03-18 17:02:11 +00:00
|
|
|
SS.ScheduleGenerateAll();
|
2008-06-30 09:09:17 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2008-09-17 10:13:37 +00:00
|
|
|
case EDIT_STEP_DIM_FINISH: {
|
2010-01-04 00:35:28 +00:00
|
|
|
Expr *e = Expr::From(s, true);
|
2008-09-17 10:13:37 +00:00
|
|
|
if(!e) {
|
|
|
|
break;
|
|
|
|
}
|
2008-07-20 11:27:22 +00:00
|
|
|
if(shown.dimIsDistance) {
|
2008-09-17 10:13:37 +00:00
|
|
|
shown.dimFinish = SS.ExprToMm(e);
|
2008-07-20 11:27:22 +00:00
|
|
|
} else {
|
2008-09-17 10:13:37 +00:00
|
|
|
shown.dimFinish = e->Eval();
|
2008-07-20 11:27:22 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-09-17 10:13:37 +00:00
|
|
|
}
|
2008-07-20 11:27:22 +00:00
|
|
|
case EDIT_STEP_DIM_STEPS:
|
|
|
|
shown.dimSteps = min(300, max(1, atoi(s)));
|
|
|
|
break;
|
2009-09-03 08:13:09 +00:00
|
|
|
|
2010-05-16 16:36:23 +00:00
|
|
|
case EDIT_TANGENT_ARC_RADIUS: {
|
|
|
|
Expr *e = Expr::From(s, true);
|
|
|
|
if(!e) break;
|
|
|
|
if(e->Eval() < LENGTH_EPS) {
|
|
|
|
Error("Radius cannot be zero or negative.");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
SS.tangentArcRadius = SS.ExprToMm(e);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-09-29 13:14:47 +00:00
|
|
|
default: {
|
2009-12-15 12:26:22 +00:00
|
|
|
int cnt = 0;
|
|
|
|
if(EditControlDoneForStyles(s)) cnt++;
|
|
|
|
if(EditControlDoneForConfiguration(s)) cnt++;
|
|
|
|
if(EditControlDoneForPaste(s)) cnt++;
|
2010-01-04 00:35:28 +00:00
|
|
|
if(EditControlDoneForView(s)) cnt++;
|
2009-12-15 12:26:22 +00:00
|
|
|
if(cnt > 1) {
|
2009-09-29 13:14:47 +00:00
|
|
|
// The identifiers were somehow assigned not uniquely?
|
|
|
|
oops();
|
2009-09-03 08:13:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
2008-06-30 09:09:17 +00:00
|
|
|
InvalidateGraphics();
|
2015-03-18 17:02:11 +00:00
|
|
|
SS.ScheduleShowTW();
|
2010-01-04 00:35:28 +00:00
|
|
|
|
|
|
|
if(!edit.showAgain) {
|
2010-07-12 07:51:12 +00:00
|
|
|
HideEditControl();
|
2010-01-04 00:35:28 +00:00
|
|
|
edit.meaning = EDIT_NOTHING;
|
|
|
|
}
|
2008-06-23 08:37:12 +00:00
|
|
|
}
|
|
|
|
|