From 9a4f6d0b364d13e115bfa6c8597bfc1f8a98f11d Mon Sep 17 00:00:00 2001 From: "varada%netscape.com" Date: Tue, 18 Jan 2000 22:39:01 +0000 Subject: [PATCH] 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 --- cck/driver/WizardTypes.h | 1 + cck/driver/WizardUI.cpp | 18 +++++++++++++----- cck/driver/interpret.cpp | 24 +++++++++++++++++++++--- cck/driver/interpret.h | 2 ++ cck/include/WizardTypes.h | 1 + 5 files changed, 38 insertions(+), 8 deletions(-) diff --git a/cck/driver/WizardTypes.h b/cck/driver/WizardTypes.h index 97015c38f5fd..a52f3a85e628 100644 --- a/cck/driver/WizardTypes.h +++ b/cck/driver/WizardTypes.h @@ -49,6 +49,7 @@ typedef struct WIDGET CString name; CString attrib; CString value; + CString display; CString title; CString group; CString target; diff --git a/cck/driver/WizardUI.cpp b/cck/driver/WizardUI.cpp index 57ff19af7645..ee64a02023fa 100644 --- a/cck/driver/WizardUI.cpp +++ b/cck/driver/WizardUI.cpp @@ -556,10 +556,16 @@ void CWizardUI::CreateControls() 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; 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") { curWidget->control = new CNavText; rv = ((CNavText*)curWidget->control)->Create(curWidget->value, SS_LEFT, tmpRect, this, ID); @@ -937,15 +943,17 @@ CString CWizardUI::GetScreenValue(WIDGET *curWidget) rv = tmpStr; } } - else if (widgetType == "DynamicText") +/* else if (widgetType == "DynamicText") { char myLine[MAX_SIZE]; curWidget->control->GetWindowText(myLine, 250); - + CString line = (CString)myLine; - rv = line; + if((line.Compare(curWidget->display)) == 0) + rv = curWidget->value; + } - +*/ else rv = curWidget->value; // !!! Fix this so we're not copying strings all the time // Should be able to just pass in an "assign" boolean diff --git a/cck/driver/interpret.cpp b/cck/driver/interpret.cpp index 4b955285ee6f..3630952ae123 100644 --- a/cck/driver/interpret.cpp +++ b/cck/driver/interpret.cpp @@ -19,7 +19,7 @@ #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif - +#define FILEPATHLENGTH 47 extern CWizardMachineApp theApp; extern NODE *CurrentNode; 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. //If it was cancelled then the value of the edit box is not changed. - if (fileDlg.GetPathName() != "") + if (retVal == IDOK) { fullFileName = fileDlg.GetPathName(); // if ((fullFileName.Right(fileLength - dotPlace -1) == fileExt) && (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; } @@ -481,6 +486,19 @@ BOOL CInterpret::CallDLL(char *dll, char *proc, char *parms, WIDGET *curWidget) 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) { diff --git a/cck/driver/interpret.h b/cck/driver/interpret.h index 979a0ab39634..e7462c422617 100644 --- a/cck/driver/interpret.h +++ b/cck/driver/interpret.h @@ -50,6 +50,8 @@ public: BOOL interpret(CString cmds, WIDGET *curWidget); BOOL CInterpret::GetRegistryKey( HKEY key, char *subkey, char *retdata ); BOOL CInterpret::OpenBrowser(const char *url); + CString CInterpret::GetTrimFile(CString filePath); + // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CWizardMachineApp) diff --git a/cck/include/WizardTypes.h b/cck/include/WizardTypes.h index 0fdc9f9a8522..c871c6309282 100644 --- a/cck/include/WizardTypes.h +++ b/cck/include/WizardTypes.h @@ -49,6 +49,7 @@ typedef struct WIDGET CString name; CString attrib; CString value; + CString display; CString title; CString group; CString target;