[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: user defined properties

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: 2006-10-21 19:27:13 CEST

John Norris wrote:
> I have added code to allow user defined property types to be displayed in
> the drop down list.
> These property names are read from two files, one holding properties for
> files and the other for directories (or folders).
> If multiple files and / or directories are selected then properties for both
> are read and displayed.
> The path and name of the property files are stored in the registry.
> I have updated the settings dialog to add a new page "User defined
> properties". This allows the user to browse and enter the name for both
> "file property" and "directory property" files.
> These files must be text files in normal ASCII. I have not tested them with
> Unicode.
> The file names are stored in the registry under
> "Software\TortoiseSVN\FilePropertyFile" and
> "Software\TortoiseSVN\DirPropertyFile".
> When using the browse button for settings, if an entry already exists, the
> dialog will open the entry's directory.
> I have not updated the help files.

Thanks for the patch. But please change what I mentioned when you sent
your patch the last time:

* don't specify a path to a config file. Either store the settings in
the registry or a file. But don't specify a path to another 'setting' in
the registry (that's like having a configuration for a configuration).
So: either store the data you now store in the file in the registry, or
use a fixed path to those files.
* Remove lines you have commented out (not the comments!). Why do you
keep lines like:
+// tmp_str = MultibyteToWide((std::string&)w1);
+// pn_temp->p1 = ::SysAllocStringLen(0, tmp_str.GetLength());
+// _tcscpy(pn_temp->p1, temp_str);
in there? That's just garbage.

Also check the following:

===================================================================
--- src/Resources/TortoiseProcENG.rc (revision 7784)
+++ src/Resources/TortoiseProcENG.rc (working copy)
@@ -1033,7 +1033,20 @@
      PUSHBUTTON "...",IDC_HOOKCOMMANDBROWSE,315,72,24,14
  END

+IDD_SETTINGSPROPERTYCONFIG DIALOGEX 0, 0, 419, 162
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "User Defined Proprties"
                        ^^^^^^^^^^
(spelling mistake)

+ if ((!m_bFolder)||(m_bMultiple))
+ {
+ m_regFPPath = CRegString(_T("Software\\TortoiseSVN\\FilePropertyFile"));
+ if (read_property_file(m_regFPPath, &pn1) == 0)
+ {
+ ptr = &pn1;
+ while (ptr->p1 != NULL)
+ {
+ m_PropNames.AddString(ptr->p1);
+ ptr = ptr->p2;
+ }
+// free up memory
+ for (ptr = &pn1; ptr->p1 != NULL; ptr = qptr)
+ {
+ qptr = ptr->p2;
+ free(ptr);
+ }
+ }
+ }

Here, I would just use CString to pass the strings from the
read_property_file function. It's way easier and doesn't require paying
attention to cleanup of memory.

+ lenW = ::MultiByteToWideChar(CP_ACP, 0, w1, i, 0, 0);
As we discussed via PM: use CString(CStringA(w1)) to convert between
ASCII and UNICODE.

+ struct pnode {
+ TCHAR *p1;
+ struct pnode *p2;
+ };
Instead of TCHAR *p1 - just use a CString.

Maybe best would be if you implement this completely in the registry.
The settings dialog could show a list control, with some "Add", "Remove"
and "Edit" buttons (just like we do now in the properties dialog).

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Sat Oct 21 19:27:30 2006

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.