Remove the back button from the text window, since I never used it.
And fix a bug; wasn't asking the user whether to save before abandoning file when a new file was opened recent. [git-p4: depot-paths = "//depot/solvespace/": change = 1830]solver
parent
7622534b2a
commit
49b6e9a74d
|
@ -237,6 +237,8 @@ void SolveSpace::UpdateWindowTitle(void) {
|
||||||
|
|
||||||
void SolveSpace::MenuFile(int id) {
|
void SolveSpace::MenuFile(int id) {
|
||||||
if(id >= RECENT_OPEN && id < (RECENT_OPEN+MAX_RECENT)) {
|
if(id >= RECENT_OPEN && id < (RECENT_OPEN+MAX_RECENT)) {
|
||||||
|
if(!SS.OkayToStartNewFile()) return;
|
||||||
|
|
||||||
char newFile[MAX_PATH];
|
char newFile[MAX_PATH];
|
||||||
strcpy(newFile, RecentFile[id-RECENT_OPEN]);
|
strcpy(newFile, RecentFile[id-RECENT_OPEN]);
|
||||||
RemoveFromRecentList(newFile);
|
RemoveFromRecentList(newFile);
|
||||||
|
|
|
@ -1,28 +1,11 @@
|
||||||
#include "solvespace.h"
|
#include "solvespace.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// A navigation bar that always appears at the top of the window.
|
// A navigation bar that always appears at the top of the window, with a
|
||||||
|
// link to bring us back home.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void TextWindow::ScreenNavigation(int link, DWORD v) {
|
void TextWindow::ScreenHome(int link, DWORD v) {
|
||||||
switch(link) {
|
SS.TW.GoToScreen(SCREEN_LIST_OF_GROUPS);
|
||||||
default:
|
|
||||||
case 'h':
|
|
||||||
SS.TW.OneScreenForwardTo(SCREEN_LIST_OF_GROUPS);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'b':
|
|
||||||
if(SS.TW.history > 0) {
|
|
||||||
SS.TW.shownIndex--;
|
|
||||||
if(SS.TW.shownIndex < 0) SS.TW.shownIndex = (HISTORY_LEN-1);
|
|
||||||
SS.TW.shown = &(SS.TW.showns[SS.TW.shownIndex]);
|
|
||||||
SS.TW.history--;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'f':
|
|
||||||
SS.TW.OneScreenForwardTo(-1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void TextWindow::ShowHeader(bool withNav) {
|
void TextWindow::ShowHeader(bool withNav) {
|
||||||
ClearScreen();
|
ClearScreen();
|
||||||
|
@ -33,9 +16,8 @@ void TextWindow::ShowHeader(bool withNav) {
|
||||||
|
|
||||||
// Navigation buttons
|
// Navigation buttons
|
||||||
if(withNav) {
|
if(withNav) {
|
||||||
Printf(false, " %Lb%f<<%E %Lh%fhome%E %Bt%Ft wrkpl:%Fd %s",
|
Printf(false, " %Fl%Lh%fhome%E %Bt%Ft wrkpl:%Fd %s",
|
||||||
(&TextWindow::ScreenNavigation),
|
(&TextWindow::ScreenHome),
|
||||||
(&TextWindow::ScreenNavigation),
|
|
||||||
cd);
|
cd);
|
||||||
} else {
|
} else {
|
||||||
Printf(false, " %Bt%Ft wrkpl:%Fd %s", cd);
|
Printf(false, " %Bt%Ft wrkpl:%Fd %s", cd);
|
||||||
|
@ -69,8 +51,8 @@ hs(SS.GW.showHdnLines), (DWORD)(&SS.GW.showHdnLines), &(SS.GW.ToggleBool)
|
||||||
// to hide or show them, and to view them in detail. This is our home page.
|
// to hide or show them, and to view them in detail. This is our home page.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void TextWindow::ScreenSelectGroup(int link, DWORD v) {
|
void TextWindow::ScreenSelectGroup(int link, DWORD v) {
|
||||||
SS.TW.OneScreenForwardTo(SCREEN_GROUP_INFO);
|
SS.TW.GoToScreen(SCREEN_GROUP_INFO);
|
||||||
SS.TW.shown->group.v = v;
|
SS.TW.shown.group.v = v;
|
||||||
}
|
}
|
||||||
void TextWindow::ScreenToggleGroupShown(int link, DWORD v) {
|
void TextWindow::ScreenToggleGroupShown(int link, DWORD v) {
|
||||||
hGroup hg = { v };
|
hGroup hg = { v };
|
||||||
|
@ -102,19 +84,19 @@ void TextWindow::ScreenActivateGroup(int link, DWORD v) {
|
||||||
}
|
}
|
||||||
void TextWindow::ReportHowGroupSolved(hGroup hg) {
|
void TextWindow::ReportHowGroupSolved(hGroup hg) {
|
||||||
SS.GW.ClearSuper();
|
SS.GW.ClearSuper();
|
||||||
SS.TW.OneScreenForwardTo(SCREEN_GROUP_SOLVE_INFO);
|
SS.TW.GoToScreen(SCREEN_GROUP_SOLVE_INFO);
|
||||||
SS.TW.shown->group.v = hg.v;
|
SS.TW.shown.group.v = hg.v;
|
||||||
SS.later.showTW = true;
|
SS.later.showTW = true;
|
||||||
}
|
}
|
||||||
void TextWindow::ScreenHowGroupSolved(int link, DWORD v) {
|
void TextWindow::ScreenHowGroupSolved(int link, DWORD v) {
|
||||||
if(SS.GW.activeGroup.v != v) {
|
if(SS.GW.activeGroup.v != v) {
|
||||||
ScreenActivateGroup(link, v);
|
ScreenActivateGroup(link, v);
|
||||||
}
|
}
|
||||||
SS.TW.OneScreenForwardTo(SCREEN_GROUP_SOLVE_INFO);
|
SS.TW.GoToScreen(SCREEN_GROUP_SOLVE_INFO);
|
||||||
SS.TW.shown->group.v = v;
|
SS.TW.shown.group.v = v;
|
||||||
}
|
}
|
||||||
void TextWindow::ScreenShowConfiguration(int link, DWORD v) {
|
void TextWindow::ScreenShowConfiguration(int link, DWORD v) {
|
||||||
SS.TW.OneScreenForwardTo(SCREEN_CONFIGURATION);
|
SS.TW.GoToScreen(SCREEN_CONFIGURATION);
|
||||||
}
|
}
|
||||||
void TextWindow::ShowListOfGroups(void) {
|
void TextWindow::ShowListOfGroups(void) {
|
||||||
Printf(true, "%Ftactv show ok group-name%E");
|
Printf(true, "%Ftactv show ok group-name%E");
|
||||||
|
@ -196,7 +178,7 @@ void TextWindow::ScreenSelectRequest(int link, DWORD v) {
|
||||||
void TextWindow::ScreenChangeOneOrTwoSides(int link, DWORD v) {
|
void TextWindow::ScreenChangeOneOrTwoSides(int link, DWORD v) {
|
||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
|
|
||||||
Group *g = SS.GetGroup(SS.TW.shown->group);
|
Group *g = SS.GetGroup(SS.TW.shown.group);
|
||||||
if(g->subtype == Group::ONE_SIDED) {
|
if(g->subtype == Group::ONE_SIDED) {
|
||||||
g->subtype = Group::TWO_SIDED;
|
g->subtype = Group::TWO_SIDED;
|
||||||
} else if(g->subtype == Group::TWO_SIDED) {
|
} else if(g->subtype == Group::TWO_SIDED) {
|
||||||
|
@ -209,7 +191,7 @@ void TextWindow::ScreenChangeOneOrTwoSides(int link, DWORD v) {
|
||||||
void TextWindow::ScreenChangeSkipFirst(int link, DWORD v) {
|
void TextWindow::ScreenChangeSkipFirst(int link, DWORD v) {
|
||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
|
|
||||||
Group *g = SS.GetGroup(SS.TW.shown->group);
|
Group *g = SS.GetGroup(SS.TW.shown.group);
|
||||||
(g->skipFirst) = !(g->skipFirst);
|
(g->skipFirst) = !(g->skipFirst);
|
||||||
SS.MarkGroupDirty(g->h);
|
SS.MarkGroupDirty(g->h);
|
||||||
SS.GenerateAll();
|
SS.GenerateAll();
|
||||||
|
@ -218,7 +200,7 @@ void TextWindow::ScreenChangeSkipFirst(int link, DWORD v) {
|
||||||
void TextWindow::ScreenChangeMeshCombine(int link, DWORD v) {
|
void TextWindow::ScreenChangeMeshCombine(int link, DWORD v) {
|
||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
|
|
||||||
Group *g = SS.GetGroup(SS.TW.shown->group);
|
Group *g = SS.GetGroup(SS.TW.shown.group);
|
||||||
g->meshCombine = v;
|
g->meshCombine = v;
|
||||||
SS.MarkGroupDirty(g->h);
|
SS.MarkGroupDirty(g->h);
|
||||||
SS.GenerateAll();
|
SS.GenerateAll();
|
||||||
|
@ -227,7 +209,7 @@ void TextWindow::ScreenChangeMeshCombine(int link, DWORD v) {
|
||||||
void TextWindow::ScreenChangeRightLeftHanded(int link, DWORD v) {
|
void TextWindow::ScreenChangeRightLeftHanded(int link, DWORD v) {
|
||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
|
|
||||||
Group *g = SS.GetGroup(SS.TW.shown->group);
|
Group *g = SS.GetGroup(SS.TW.shown.group);
|
||||||
if(g->subtype == Group::RIGHT_HANDED) {
|
if(g->subtype == Group::RIGHT_HANDED) {
|
||||||
g->subtype = Group::LEFT_HANDED;
|
g->subtype = Group::LEFT_HANDED;
|
||||||
} else {
|
} else {
|
||||||
|
@ -238,7 +220,7 @@ void TextWindow::ScreenChangeRightLeftHanded(int link, DWORD v) {
|
||||||
SS.GW.ClearSuper();
|
SS.GW.ClearSuper();
|
||||||
}
|
}
|
||||||
void TextWindow::ScreenChangeHelixParameter(int link, DWORD v) {
|
void TextWindow::ScreenChangeHelixParameter(int link, DWORD v) {
|
||||||
Group *g = SS.GetGroup(SS.TW.shown->group);
|
Group *g = SS.GetGroup(SS.TW.shown.group);
|
||||||
char str[1024];
|
char str[1024];
|
||||||
int r;
|
int r;
|
||||||
if(link == 't') {
|
if(link == 't') {
|
||||||
|
@ -260,7 +242,7 @@ void TextWindow::ScreenChangeHelixParameter(int link, DWORD v) {
|
||||||
void TextWindow::ScreenColor(int link, DWORD v) {
|
void TextWindow::ScreenColor(int link, DWORD v) {
|
||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
|
|
||||||
Group *g = SS.GetGroup(SS.TW.shown->group);
|
Group *g = SS.GetGroup(SS.TW.shown.group);
|
||||||
if(v < 0 || v >= SS.MODEL_COLORS) return;
|
if(v < 0 || v >= SS.MODEL_COLORS) return;
|
||||||
g->color = SS.modelColor[v];
|
g->color = SS.modelColor[v];
|
||||||
SS.MarkGroupDirty(g->h);
|
SS.MarkGroupDirty(g->h);
|
||||||
|
@ -268,7 +250,7 @@ void TextWindow::ScreenColor(int link, DWORD v) {
|
||||||
SS.GW.ClearSuper();
|
SS.GW.ClearSuper();
|
||||||
}
|
}
|
||||||
void TextWindow::ScreenChangeExprA(int link, DWORD v) {
|
void TextWindow::ScreenChangeExprA(int link, DWORD v) {
|
||||||
Group *g = SS.GetGroup(SS.TW.shown->group);
|
Group *g = SS.GetGroup(SS.TW.shown.group);
|
||||||
|
|
||||||
// There's an extra line for the skipFirst parameter in one-sided groups.
|
// There's an extra line for the skipFirst parameter in one-sided groups.
|
||||||
int r = (g->subtype == Group::ONE_SIDED) ? 15 : 13;
|
int r = (g->subtype == Group::ONE_SIDED) ? 15 : 13;
|
||||||
|
@ -280,7 +262,7 @@ void TextWindow::ScreenChangeExprA(int link, DWORD v) {
|
||||||
SS.TW.edit.group.v = v;
|
SS.TW.edit.group.v = v;
|
||||||
}
|
}
|
||||||
void TextWindow::ScreenChangeGroupName(int link, DWORD v) {
|
void TextWindow::ScreenChangeGroupName(int link, DWORD v) {
|
||||||
Group *g = SS.GetGroup(SS.TW.shown->group);
|
Group *g = SS.GetGroup(SS.TW.shown.group);
|
||||||
ShowTextEditControl(7, 14, g->DescriptionString()+5);
|
ShowTextEditControl(7, 14, g->DescriptionString()+5);
|
||||||
SS.TW.edit.meaning = EDIT_GROUP_NAME;
|
SS.TW.edit.meaning = EDIT_GROUP_NAME;
|
||||||
SS.TW.edit.group.v = v;
|
SS.TW.edit.group.v = v;
|
||||||
|
@ -288,23 +270,23 @@ void TextWindow::ScreenChangeGroupName(int link, DWORD v) {
|
||||||
void TextWindow::ScreenDeleteGroup(int link, DWORD v) {
|
void TextWindow::ScreenDeleteGroup(int link, DWORD v) {
|
||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
|
|
||||||
hGroup hg = SS.TW.shown->group;
|
hGroup hg = SS.TW.shown.group;
|
||||||
if(hg.v == SS.GW.activeGroup.v) {
|
if(hg.v == SS.GW.activeGroup.v) {
|
||||||
Error("This group is currently active; activate a different group "
|
Error("This group is currently active; activate a different group "
|
||||||
"before proceeding.");
|
"before proceeding.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SS.group.RemoveById(SS.TW.shown->group);
|
SS.group.RemoveById(SS.TW.shown.group);
|
||||||
// This is a major change, so let's re-solve everything.
|
// This is a major change, so let's re-solve everything.
|
||||||
SS.TW.ClearSuper();
|
SS.TW.ClearSuper();
|
||||||
SS.GW.ClearSuper();
|
SS.GW.ClearSuper();
|
||||||
SS.GenerateAll(0, INT_MAX);
|
SS.GenerateAll(0, INT_MAX);
|
||||||
}
|
}
|
||||||
void TextWindow::ShowGroupInfo(void) {
|
void TextWindow::ShowGroupInfo(void) {
|
||||||
Group *g = SS.group.FindById(shown->group);
|
Group *g = SS.group.FindById(shown.group);
|
||||||
char *s, *s2, *s3;
|
char *s, *s2, *s3;
|
||||||
|
|
||||||
if(shown->group.v == Group::HGROUP_REFERENCES.v) {
|
if(shown.group.v == Group::HGROUP_REFERENCES.v) {
|
||||||
Printf(true, "%FtGROUP %E%s", g->DescriptionString());
|
Printf(true, "%FtGROUP %E%s", g->DescriptionString());
|
||||||
} else {
|
} else {
|
||||||
Printf(true, "%FtGROUP %E%s "
|
Printf(true, "%FtGROUP %E%s "
|
||||||
|
@ -445,7 +427,7 @@ void TextWindow::ShowGroupInfo(void) {
|
||||||
for(i = 0; i < SS.request.n; i++) {
|
for(i = 0; i < SS.request.n; i++) {
|
||||||
Request *r = &(SS.request.elem[i]);
|
Request *r = &(SS.request.elem[i]);
|
||||||
|
|
||||||
if(r->group.v == shown->group.v) {
|
if(r->group.v == shown.group.v) {
|
||||||
char *s = r->DescriptionString();
|
char *s = r->DescriptionString();
|
||||||
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E",
|
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E",
|
||||||
(a & 1) ? 'd' : 'a',
|
(a & 1) ? 'd' : 'a',
|
||||||
|
@ -461,7 +443,7 @@ void TextWindow::ShowGroupInfo(void) {
|
||||||
for(i = 0; i < SS.constraint.n; i++) {
|
for(i = 0; i < SS.constraint.n; i++) {
|
||||||
Constraint *c = &(SS.constraint.elem[i]);
|
Constraint *c = &(SS.constraint.elem[i]);
|
||||||
|
|
||||||
if(c->group.v == shown->group.v) {
|
if(c->group.v == shown.group.v) {
|
||||||
char *s = c->DescriptionString();
|
char *s = c->DescriptionString();
|
||||||
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E %s",
|
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E %s",
|
||||||
(a & 1) ? 'd' : 'a',
|
(a & 1) ? 'd' : 'a',
|
||||||
|
@ -480,10 +462,10 @@ void TextWindow::ShowGroupInfo(void) {
|
||||||
// constraints that could be removed to fix it.
|
// constraints that could be removed to fix it.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void TextWindow::ShowGroupSolveInfo(void) {
|
void TextWindow::ShowGroupSolveInfo(void) {
|
||||||
Group *g = SS.group.FindById(shown->group);
|
Group *g = SS.group.FindById(shown.group);
|
||||||
if(g->solved.how == Group::SOLVED_OKAY) {
|
if(g->solved.how == Group::SOLVED_OKAY) {
|
||||||
// Go back to the default group info screen
|
// Go back to the default group info screen
|
||||||
shown->screen = SCREEN_GROUP_INFO;
|
shown.screen = SCREEN_GROUP_INFO;
|
||||||
Show();
|
Show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
14
textwin.cpp
14
textwin.cpp
|
@ -28,7 +28,6 @@ void TextWindow::Init(void) {
|
||||||
void TextWindow::ClearSuper(void) {
|
void TextWindow::ClearSuper(void) {
|
||||||
HideTextEditControl();
|
HideTextEditControl();
|
||||||
memset(this, 0, sizeof(*this));
|
memset(this, 0, sizeof(*this));
|
||||||
shown = &(showns[shownIndex]);
|
|
||||||
ClearScreen();
|
ClearScreen();
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
@ -212,9 +211,9 @@ void TextWindow::Show(void) {
|
||||||
} else {
|
} else {
|
||||||
if(edit.meaning == EDIT_TTF_TEXT) HideTextEditControl();
|
if(edit.meaning == EDIT_TTF_TEXT) HideTextEditControl();
|
||||||
ShowHeader(true);
|
ShowHeader(true);
|
||||||
switch(shown->screen) {
|
switch(shown.screen) {
|
||||||
default:
|
default:
|
||||||
shown->screen = SCREEN_LIST_OF_GROUPS;
|
shown.screen = SCREEN_LIST_OF_GROUPS;
|
||||||
// fall through
|
// fall through
|
||||||
case SCREEN_LIST_OF_GROUPS: ShowListOfGroups(); break;
|
case SCREEN_LIST_OF_GROUPS: ShowListOfGroups(); break;
|
||||||
case SCREEN_GROUP_INFO: ShowGroupInfo(); break;
|
case SCREEN_GROUP_INFO: ShowGroupInfo(); break;
|
||||||
|
@ -464,12 +463,7 @@ void TextWindow::DescribeSelection(void) {
|
||||||
Printf(true, "%Fl%f%Ll(unselect all)%E", &TextWindow::ScreenUnselectAll);
|
Printf(true, "%Fl%f%Ll(unselect all)%E", &TextWindow::ScreenUnselectAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextWindow::OneScreenForwardTo(int screen) {
|
void TextWindow::GoToScreen(int screen) {
|
||||||
SS.TW.shownIndex++;
|
shown.screen = screen;
|
||||||
if(SS.TW.shownIndex >= HISTORY_LEN) SS.TW.shownIndex = 0;
|
|
||||||
SS.TW.shown = &(SS.TW.showns[SS.TW.shownIndex]);
|
|
||||||
history++;
|
|
||||||
|
|
||||||
if(screen >= 0) shown->screen = screen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
ui.h
10
ui.h
|
@ -50,11 +50,7 @@ public:
|
||||||
int screen;
|
int screen;
|
||||||
hGroup group;
|
hGroup group;
|
||||||
} ShownState;
|
} ShownState;
|
||||||
static const int HISTORY_LEN = 16;
|
ShownState shown;
|
||||||
ShownState showns[HISTORY_LEN];
|
|
||||||
int shownIndex;
|
|
||||||
int history;
|
|
||||||
ShownState *shown;
|
|
||||||
|
|
||||||
static const int EDIT_NOTHING = 0;
|
static const int EDIT_NOTHING = 0;
|
||||||
static const int EDIT_TIMES_REPEATED = 1;
|
static const int EDIT_TIMES_REPEATED = 1;
|
||||||
|
@ -91,7 +87,7 @@ public:
|
||||||
// Special screen, based on selection
|
// Special screen, based on selection
|
||||||
void DescribeSelection(void);
|
void DescribeSelection(void);
|
||||||
|
|
||||||
void OneScreenForwardTo(int screen);
|
void GoToScreen(int screen);
|
||||||
|
|
||||||
// All of these are callbacks from the GUI code; first from when
|
// All of these are callbacks from the GUI code; first from when
|
||||||
// we're describing an entity
|
// we're describing an entity
|
||||||
|
@ -121,7 +117,7 @@ public:
|
||||||
|
|
||||||
static void ScreenShowConfiguration(int link, DWORD v);
|
static void ScreenShowConfiguration(int link, DWORD v);
|
||||||
|
|
||||||
static void ScreenNavigation(int link, DWORD v);
|
static void ScreenHome(int link, DWORD v);
|
||||||
|
|
||||||
// These ones do stuff with the edit control
|
// These ones do stuff with the edit control
|
||||||
static void ScreenChangeExprA(int link, DWORD v);
|
static void ScreenChangeExprA(int link, DWORD v);
|
||||||
|
|
|
@ -448,7 +448,7 @@ static BOOL ProcessKeyDown(WPARAM wParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(wParam == VK_BACK && !GraphicsEditControlIsVisible()) {
|
if(wParam == VK_BACK && !GraphicsEditControlIsVisible()) {
|
||||||
TextWindow::ScreenNavigation('b', 0);
|
TextWindow::ScreenHome(0, 0);
|
||||||
SS.TW.Show();
|
SS.TW.Show();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
some kind of rounding / chamfer
|
some kind of rounding / chamfer
|
||||||
remove back button in browser?
|
|
||||||
auto-generate circles and faces when lathing
|
auto-generate circles and faces when lathing
|
||||||
copy the section geometry to other end when sweeping
|
copy the section geometry to other end when sweeping
|
||||||
cylindrical faces
|
cylindrical faces
|
||||||
|
|
Loading…
Reference in New Issue