fix for shortening the file names in the display bug #22947 - introduced a new CString display in the WIDGET struct which will contain the values for the display

This commit is contained in:
varada%netscape.com 2000-01-18 22:39:01 +00:00
Родитель f5b56c6147
Коммит 3cbacfb69a
5 изменённых файлов: 38 добавлений и 8 удалений

Просмотреть файл

@ -49,6 +49,7 @@ typedef struct WIDGET
CString name; CString name;
CString attrib; CString attrib;
CString value; CString value;
CString display;
CString title; CString title;
CString group; CString group;
CString target; CString target;

Просмотреть файл

@ -556,10 +556,16 @@ void CWizardUI::CreateControls()
CRect tmpRect = CRect(s_x, s_y, (s_x + s_width), (s_y + s_height)); CRect tmpRect = CRect(s_x, s_y, (s_x + s_width), (s_y + s_height));
if (widgetType == "Text" || widgetType == "BoldText" || widgetType == "DynamicText") { if (widgetType == "Text" || widgetType == "BoldText") {
curWidget->control = new CStatic; curWidget->control = new CStatic;
rv = ((CStatic*)curWidget->control)->Create(curWidget->value, SS_LEFT, tmpRect, this, ID); rv = ((CStatic*)curWidget->control)->Create(curWidget->value, SS_LEFT, tmpRect, this, ID);
} }
else if (widgetType == "DynamicText") {
curWidget->control = new CStatic;
curWidget->display = theInterpreter->GetTrimFile(curWidget->value);
rv = ((CStatic*)curWidget->control)->Create(curWidget->display, SS_LEFT, tmpRect, this, ID);
}
else if (widgetType == "Navigation Text") { else if (widgetType == "Navigation Text") {
curWidget->control = new CNavText; curWidget->control = new CNavText;
rv = ((CNavText*)curWidget->control)->Create(curWidget->value, SS_LEFT, tmpRect, this, ID); rv = ((CNavText*)curWidget->control)->Create(curWidget->value, SS_LEFT, tmpRect, this, ID);
@ -937,15 +943,17 @@ CString CWizardUI::GetScreenValue(WIDGET *curWidget)
rv = tmpStr; rv = tmpStr;
} }
} }
else if (widgetType == "DynamicText") /* else if (widgetType == "DynamicText")
{ {
char myLine[MAX_SIZE]; char myLine[MAX_SIZE];
curWidget->control->GetWindowText(myLine, 250); curWidget->control->GetWindowText(myLine, 250);
CString line = (CString)myLine; CString line = (CString)myLine;
rv = line; if((line.Compare(curWidget->display)) == 0)
rv = curWidget->value;
} }
*/
else else
rv = curWidget->value; // !!! Fix this so we're not copying strings all the time rv = curWidget->value; // !!! Fix this so we're not copying strings all the time
// Should be able to just pass in an "assign" boolean // Should be able to just pass in an "assign" boolean

Просмотреть файл

@ -19,7 +19,7 @@
#undef THIS_FILE #undef THIS_FILE
static char THIS_FILE[] = __FILE__; static char THIS_FILE[] = __FILE__;
#endif #endif
#define FILEPATHLENGTH 47
extern CWizardMachineApp theApp; extern CWizardMachineApp theApp;
extern NODE *CurrentNode; extern NODE *CurrentNode;
extern HBITMAP hBitmap; extern HBITMAP hBitmap;
@ -136,13 +136,18 @@ BOOL CInterpret::BrowseFile(WIDGET *curWidget)
//Checking to see if the open file dialog did get a value or was merely cancelled. //Checking to see if the open file dialog did get a value or was merely cancelled.
//If it was cancelled then the value of the edit box is not changed. //If it was cancelled then the value of the edit box is not changed.
if (fileDlg.GetPathName() != "") if (retVal == IDOK)
{ {
fullFileName = fileDlg.GetPathName(); fullFileName = fileDlg.GetPathName();
// if ((fullFileName.Right(fileLength - dotPlace -1) == fileExt) && (tmpWidget && (CEdit*)tmpWidget->control)) // if ((fullFileName.Right(fileLength - dotPlace -1) == fileExt) && (tmpWidget && (CEdit*)tmpWidget->control))
if (tmpWidget && (CEdit*)tmpWidget->control) if (tmpWidget && (CEdit*)tmpWidget->control)
((CEdit*)tmpWidget->control)->SetWindowText(fullFileName); {
tmpWidget->value = fullFileName;
tmpWidget->display = GetTrimFile(fullFileName);
}
} }
((CEdit*)tmpWidget->control)->SetWindowText(tmpWidget->display);
return TRUE; return TRUE;
} }
@ -481,6 +486,19 @@ BOOL CInterpret::CallDLL(char *dll, char *proc, char *parms, WIDGET *curWidget)
return TRUE; return TRUE;
} }
CString CInterpret::GetTrimFile(CString filePath)
{
int fileLength=0;
int findSlash=0;
fileLength = filePath.GetLength();
if (fileLength > FILEPATHLENGTH)
{
findSlash = filePath.Find('\\');
filePath.Delete(findSlash+1,(fileLength - FILEPATHLENGTH));
filePath.Insert(findSlash+1,"...");
}
return filePath;
}
BOOL CInterpret::interpret(char *cmds, WIDGET *curWidget) BOOL CInterpret::interpret(char *cmds, WIDGET *curWidget)
{ {

Просмотреть файл

@ -50,6 +50,8 @@ public:
BOOL interpret(CString cmds, WIDGET *curWidget); BOOL interpret(CString cmds, WIDGET *curWidget);
BOOL CInterpret::GetRegistryKey( HKEY key, char *subkey, char *retdata ); BOOL CInterpret::GetRegistryKey( HKEY key, char *subkey, char *retdata );
BOOL CInterpret::OpenBrowser(const char *url); BOOL CInterpret::OpenBrowser(const char *url);
CString CInterpret::GetTrimFile(CString filePath);
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWizardMachineApp) //{{AFX_VIRTUAL(CWizardMachineApp)

Просмотреть файл

@ -49,6 +49,7 @@ typedef struct WIDGET
CString name; CString name;
CString attrib; CString attrib;
CString value; CString value;
CString display;
CString title; CString title;
CString group; CString group;
CString target; CString target;