PDA

View Full Version : Slight change to Browse_Mode values in 6.22



mrvedit
September 29th, 2011, 05:04 PM
Several months ago, Pauli Lindgren reported this to me:

----- Original Message -----
> While working with projsave.vdm, I found some problems with
> Browse_Mode command.
>
> If the file was opened with "[] Open as Read Only" selected in File
> Open dialog, Browse_Mode returns 0x20. According to the Help, it
> should be 0x40 (or perhaps 0x60?).
> Because of this, files opened with Read Only option are not read-only
> when the project is opened next time.
>
> (We could use mask 0x20, but it is set in other cases, too.)
> This problem was already in 6.15 (and maybe on earlier versions,
> too.)

I finally got around to examining this in detail and have modified the code to set the 0x40 mask
as suggested by Pauli. What troubled me is that I had explicitly added code a very long time
ago to strip the 0x40 bit. That now appears to have been done for obsolete reasons.

Both projsave.vdm amd veditsav.vdm look at Browse_Mode and mask it with 0xC2 to determine
if the file should be opened in browse-only mode the next time. 0xC2 corresponds to 0x80 ("-b" option),
0x40 (dialog box option) and 0x02 (File_Open(...,BROWSE) command) which are the three ways a user
can choose to open a file in browse-only mode. If a file has read-only attributes it will also be
opened in browse-only mode with Browse_Mode then set to 0x20. However since that is not the user's
choice, the 0x20 mask is not saved. If the file later has read/write attributes, VEDIT will then open it
for full editing. I think this is what most users would expect.

I hope this very subtle change and my description is understandable.

The preliminary 6.22 with this change is available at www.vedit.com/download/beta/vpw.exe

Ted.