History log of /haiku/src/kits/translation/TranslationUtils.cpp
Revision Date Author Comments
# 05f730b0 11-Nov-2018 Augustin Cavalier <waddlesplash@gmail.com>

More WriteAttr -> WriteAttrString cleanup across the tree.

Some of these were correct as they were ... but most weren't.
There are a variety of other correct ones I didn't change over yet
that someone else probably should (GCI task?).


# 827f11e9 11-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

Whitespace cleanup only.


# 3aeed660 07-Aug-2014 Jérôme Duval <jerome.duval@gmail.com>

include strings.h where appriopriate...

instead or additionally to string.h, in preparation for functions move.
* moves str[n]casecmp() functions and others to strings.h.
* strings.h doesn't include string.h anymore.
* this solves #10949


# e7730456 06-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Actually sort the translator menu used in ShowImage.

There were two problems with the last commit:

* the list needed to be outside of the top-level loop.
* BList was just broken for sorting translation_format pointers.

I fixed this by moving the loop outside and converting the translation_formats
to translator_info, which has the translator_id, since that is needed to create
the menu item, and would otherwise be unavailable outside the loop.

I tried to get this working with BList, but the sorting was completely broken,
and converting to BObjectList made the code much, much better and worked great.
Screw BList and casting, hurray templated BObjectList.

Really fixes #6782.


# adfe152e 06-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Sort the translation formats in AddTranslationItems by name.

This is used by ShowImage and CodyCam to create a list of image formats which a
file can be saved as. Tracker sorts the image MIME types used in the Find
window by name, so this makes these Save As menus match that (minus the icons
which I think are superfluous.)

Fixes #6782.

If the use of BList is no longer recommended, I welcome better suggestions
for sorting which will work in both GCC2 and GCC4. But this works ;)


# 708f792e 22-Sep-2008 Michael Lotz <mmlr@mlotz.ch>

In r16700 the name and meaning of that loop condition variable was flipped
around, but the condition itself wasn't which resulted in the code never being
executed. Fixes CID 88.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27692 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 849de6ef 16-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Added another GetStyledText() function to force a specific encoding.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19847 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8acdd17f 17-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Added WriteStyledEditFile() variant that gets an encoding argument; it will automatically
encode the text in the BTextView accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19841 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 450a5aea 16-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

* GetStyledText() is now much more forgiving when it comes to corrupted data
(ie. if the text file is cut off, it will no longer return an error, but
load as much as possible).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19831 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d75df30b 12-Sep-2006 Jérôme Duval <korli@users.berlios.de>

fix R5 build as suggested by Stefano (please check :))


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18820 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b0bc48fb 19-May-2006 Axel Dörfler <axeld@pinc-software.de>

Some more GCC 4 and PPC fixes.
* Mesa doesn't compile yet, as some PPC specific stuff seems to be
missing, Philippe?
* Cortex and some other stuff has been marked x86-only, although
it's more of a "GCC 2.95.3"-only.
* I'm not sure if it's a bug in GCC 4, or if that's what the C
standard demands, but sizeof(some_type::some_field) is not
valid anymore :-/


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17515 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d7424bc7 28-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

Fixed build of the test environment as reported by Stephan.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17253 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9acf186f 10-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* Made GetStyledText() and WriteStyledEditFile() more robust against errors.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16700 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c8057f9b 04-Jan-2004 Matthew Wilber <mwilber@nowhere.fake>

Changed WriteStyledEditFile to be able to write plain text files on volumes that don't support attributes. Contributed by Andrew Bachmann


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5904 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 73e65d4d 25-Oct-2003 Matthew Wilber <mwilber@nowhere.fake>

Changed TranslationUtils' manor of handling relative paths to match how Be's TranslationUtils handles them. Before, relative paths had the current directory as the base, now, relative paths use the folder containing the running application as the base. This issue prevented programs like Eden from loading properly with the OpenBeOS Translation Kit.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5162 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d3fdd732 26-Aug-2003 shatty <shatty@nowhere.fake>

fix the "extra bytes at the end" bug that happens when the existing file has more bytes than the new file. I chose to SetSize(textLength) after Write instead of SetSize(0) before the Write because there is less of a chance of complete data loss if the Write fails somehow. right? (write?) :-)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4385 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 032ae6c6 28-Dec-2002 Matthew Wilber <mwilber@nowhere.fake>

added writing of "be:encoding" attribute to WriteStyledEditFile()


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2313 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9a18e28b 27-Dec-2002 Matthew Wilber <mwilber@nowhere.fake>

added more attribute writing to BTranslationUtils::WriteStyledEditFile() to better match what Be's StyledEdit writes for attributes. The code is still missing "be:encoding" but I want to make sure that I understand it fully before I add it.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2312 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5f4bf7bf 12-Dec-2002 Matthew Wilber <mwilber@nowhere.fake>

moved the logic from an unnessecary function to a nessecary function, and eliminated the unnessecary function


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2232 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c48048d3 17-Oct-2002 Matthew Wilber <mwilber@nowhere.fake>

fixed spelling and changed casting from C-style to new C++ style


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1570 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a38012 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 827f11e9866b2a40c592389529045ba7166607ad 11-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

Whitespace cleanup only.


# 3aeed6607cd07762c0e709633c012b3a632dbad9 07-Aug-2014 Jérôme Duval <jerome.duval@gmail.com>

include strings.h where appriopriate...

instead or additionally to string.h, in preparation for functions move.
* moves str[n]casecmp() functions and others to strings.h.
* strings.h doesn't include string.h anymore.
* this solves #10949


# e77304562da050fbc739b99474f8b5bfad0cf5b2 06-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Actually sort the translator menu used in ShowImage.

There were two problems with the last commit:

* the list needed to be outside of the top-level loop.
* BList was just broken for sorting translation_format pointers.

I fixed this by moving the loop outside and converting the translation_formats
to translator_info, which has the translator_id, since that is needed to create
the menu item, and would otherwise be unavailable outside the loop.

I tried to get this working with BList, but the sorting was completely broken,
and converting to BObjectList made the code much, much better and worked great.
Screw BList and casting, hurray templated BObjectList.

Really fixes #6782.


# adfe152ee269d1d6153827ca38a174f217d2634d 06-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Sort the translation formats in AddTranslationItems by name.

This is used by ShowImage and CodyCam to create a list of image formats which a
file can be saved as. Tracker sorts the image MIME types used in the Find
window by name, so this makes these Save As menus match that (minus the icons
which I think are superfluous.)

Fixes #6782.

If the use of BList is no longer recommended, I welcome better suggestions
for sorting which will work in both GCC2 and GCC4. But this works ;)


# 708f792eccf458bdcede97bd4aee549c93e309e6 22-Sep-2008 Michael Lotz <mmlr@mlotz.ch>

In r16700 the name and meaning of that loop condition variable was flipped
around, but the condition itself wasn't which resulted in the code never being
executed. Fixes CID 88.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27692 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 849de6ef97abbd7348813f57e549c8bea9a3180d 16-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Added another GetStyledText() function to force a specific encoding.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19847 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8acdd17f08d9bb540cb943c7f82842372785e82f 17-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Added WriteStyledEditFile() variant that gets an encoding argument; it will automatically
encode the text in the BTextView accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19841 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 450a5aea22c0c77d9546f2200dcf0c0ac364e511 16-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

* GetStyledText() is now much more forgiving when it comes to corrupted data
(ie. if the text file is cut off, it will no longer return an error, but
load as much as possible).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19831 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d75df30b25799d1529134c69adb9d1502b4bc9b6 12-Sep-2006 Jérôme Duval <korli@users.berlios.de>

fix R5 build as suggested by Stefano (please check :))


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18820 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b0bc48fbd360f10cee1856e03393c63dcbdd180f 19-May-2006 Axel Dörfler <axeld@pinc-software.de>

Some more GCC 4 and PPC fixes.
* Mesa doesn't compile yet, as some PPC specific stuff seems to be
missing, Philippe?
* Cortex and some other stuff has been marked x86-only, although
it's more of a "GCC 2.95.3"-only.
* I'm not sure if it's a bug in GCC 4, or if that's what the C
standard demands, but sizeof(some_type::some_field) is not
valid anymore :-/


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17515 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d7424bc7908cd1e35452bb549be1436f7d43743f 28-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

Fixed build of the test environment as reported by Stephan.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17253 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9acf186f65e9254ff2fba5e1d7c4b88f61ca713d 10-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* Made GetStyledText() and WriteStyledEditFile() more robust against errors.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16700 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c8057f9baae4fdbdf9798dde13530bafab4fcc56 04-Jan-2004 Matthew Wilber <mwilber@nowhere.fake>

Changed WriteStyledEditFile to be able to write plain text files on volumes that don't support attributes. Contributed by Andrew Bachmann


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5904 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 73e65d4da8432f40504f9eee71b0f193fa678d77 25-Oct-2003 Matthew Wilber <mwilber@nowhere.fake>

Changed TranslationUtils' manor of handling relative paths to match how Be's TranslationUtils handles them. Before, relative paths had the current directory as the base, now, relative paths use the folder containing the running application as the base. This issue prevented programs like Eden from loading properly with the OpenBeOS Translation Kit.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5162 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d3fdd732faa5e3af2d0029ec5b385399d62f4b3e 26-Aug-2003 shatty <shatty@nowhere.fake>

fix the "extra bytes at the end" bug that happens when the existing file has more bytes than the new file. I chose to SetSize(textLength) after Write instead of SetSize(0) before the Write because there is less of a chance of complete data loss if the Write fails somehow. right? (write?) :-)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4385 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 032ae6c6e4b0f580f9c7743014fe283b7be39d62 28-Dec-2002 Matthew Wilber <mwilber@nowhere.fake>

added writing of "be:encoding" attribute to WriteStyledEditFile()


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2313 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9a18e28b6d460addae1a46309f639e66fd2d686b 27-Dec-2002 Matthew Wilber <mwilber@nowhere.fake>

added more attribute writing to BTranslationUtils::WriteStyledEditFile() to better match what Be's StyledEdit writes for attributes. The code is still missing "be:encoding" but I want to make sure that I understand it fully before I add it.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2312 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5f4bf7bf85bddf53c364461e051c86a199fc9de2 12-Dec-2002 Matthew Wilber <mwilber@nowhere.fake>

moved the logic from an unnessecary function to a nessecary function, and eliminated the unnessecary function


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2232 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c48048d386b7dc7a46d4dfb9137aa6b43987604a 17-Oct-2002 Matthew Wilber <mwilber@nowhere.fake>

fixed spelling and changed casting from C-style to new C++ style


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1570 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96