Show the open filename in the title bar of the graphics window.

[git-p4: depot-paths = "//depot/solvespace/": change = 1826]
solver
Jonathan Westhues 2008-07-08 00:02:22 -08:00
parent 9136d86bff
commit 4c42f329cd
3 changed files with 21 additions and 0 deletions

View File

@ -150,6 +150,8 @@ void SolveSpace::AfterNewFile(void) {
later.showTW = true;
// Then zoom to fit again, to fit the triangles
GW.ZoomToFit();
UpdateWindowTitle();
}
void SolveSpace::RemoveFromRecentList(char *file) {
@ -209,6 +211,16 @@ bool SolveSpace::OkayToStartNewFile(void) {
}
}
void SolveSpace::UpdateWindowTitle(void) {
if(strlen(saveFile) == 0) {
SetWindowTitle("SolveSpace - (not yet saved)");
} else {
char buf[MAX_PATH+100];
sprintf(buf, "SolveSpace - %s", saveFile);
SetWindowTitle(buf);
}
}
void SolveSpace::MenuFile(int id) {
if(id >= RECENT_OPEN && id < (RECENT_OPEN+MAX_RECENT)) {
char newFile[MAX_PATH];
@ -287,4 +299,6 @@ void SolveSpace::MenuFile(int id) {
default: oops();
}
SS.UpdateWindowTitle();
}

View File

@ -89,8 +89,10 @@ void dbp(char *str, ...);
dbp("tri: (%.3f %.3f %.3f) (%.3f %.3f %.3f) (%.3f %.3f %.3f)", \
CO((tri).a), CO((tri).b), CO((tri).c))
void SetWindowTitle(char *str);
void Error(char *str, ...);
void ExitNow(void);
void CnfFreezeString(char *str, char *name);
void CnfFreezeDWORD(DWORD v, char *name);
void CnfFreezeFloat(float v, char *name);
@ -398,6 +400,7 @@ public:
bool GetFilenameAndSave(bool saveAs);
bool OkayToStartNewFile(void);
hGroup CreateDefaultDrawingGroup(void);
void UpdateWindowTitle(void);
void NewFile(void);
bool SaveToFile(char *filename);
bool LoadFromFile(char *filename);

View File

@ -102,6 +102,10 @@ float CnfThawFloat(float v, char *name) {
return *((float *)&d);
}
void SetWindowTitle(char *str) {
SetWindowText(GraphicsWnd, str);
}
//-----------------------------------------------------------------------------
// A separate heap, on which we allocate expressions. Maybe a bit faster,