hpavlov / tangra3

Software for data reduction of astronomical video observations
Other
6 stars 6 forks source link

Save light curve default image file format #22

Closed MurrayForbes closed 3 years ago

MurrayForbes commented 3 years ago

Change the default image file format from bmp to png for the lightcurve plot's File/Export lightcurve/save as image file' code (png uses a lossless image compression but results in smaller file sizes than bmp). Also remember the image format used last time Tangra was run, and set it as the default image format.

hpavlov commented 3 years ago

Hi Murray,

MurrayForbes commented 3 years ago

Hristo,

Sorry about the white space, I did it before your email about not doing it on a whole file or project.

Have just changed the enums, and pushed the commit.

Cheers, Murray.

Sent from Mail for Windows 10

From: hpavlov Sent: Wednesday, 23 June 2021 10:58 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

Hi Murray, • Please don't change white space as it makes code review very difficult. The alternative would be to have white space changes only in a separate commit. However I'd rather make the reformatting or the entire code base not on single files. For now I suggest that no white space is changed. • The naming convention for enums values followed in the code base is Pascal case i.e. start with capital letter. So in your case this could be: • public enum SaveAsImageFormat • { • Png, • Bmp, • Jpg • } — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

hpavlov commented 3 years ago

Because you have already added all the files inside the .vs directory to the commit, excluding the directory in the .gitignore will not be enough. You will also need to remove the files from the commit.

Another alternative is to do an entirely new commit copying the changes over. Then when you initiate the new commit the .gitignore change will 'kick in' and the files inside .vs will not be added as part of the commit.

MurrayForbes commented 3 years ago

Not sure if I’ve done this right, but here goes ....

Sent from Mail for Windows 10

From: hpavlov Sent: Thursday, 24 June 2021 8:02 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

Because you have already added all the files inside the .vs directory to the commit, excluding the directory in the .gitignore will not be enough. You will also need to remove the files from the commit. Another alternative is to do an entirely new commit copying the changes over. Then when you initiate the new commit the .gitignore change will 'kick in' and the files inside .vs will not be added as part of the commit. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

MurrayForbes commented 3 years ago

My bad – I’d been trying out a few things (which didn’t work) and forgot to remove everything.

Cheers, Murray.

Sent from Mail for Windows 10

From: hpavlov Sent: Thursday, 24 June 2021 9:39 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

@hpavlov commented on this pull request.

In Tangra.Model/Config/TangraConfig.cs:

@@ -1153,7 +1163,10 @@ public Color Target4Color

        public static Font LabelsFont = new Font(FontFamily.GenericMonospace, 9);
MurrayForbes commented 3 years ago

Okay, renamed.

I’ve noticed there is a lot of messages for words that violate the naming rules, for example ‘Naming rule violation: these words must begin with upper case characters frmLightCurve_FormClosed’.

I think I missed my naming violation in the forest of similar messages.

Cheers, Murray.

Sent from Mail for Windows 10

From: hpavlov Sent: Thursday, 24 June 2021 9:49 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

@hpavlov commented on this pull request.

In Tangra 3/VideoOperations/LightCurves/frmLightCurve.cs:

         Bitmap bmp = AddImageLegend();
hpavlov commented 3 years ago

VS or Resharper (if using) may offer their own naming convention. My point was that it is better if the entire code base of an application uses the same naming convention and there are different naming conventions that could be ued. I already know that Tangra's code base does not conform to the VS suggested one or other more commonly used ones. So wanted to point out what the naming convention is (see below). You should stick to that and can ignore messages from VS. member variables (non-public): prefixed with m then PascalCasestatic variables (non-public): prefixed with s then PascalCase public members/properties/functions/enum values: PascalCaselocal variables: camelCaseconstants: ALL_CAPS_SNAKE_CASEvisual controls: camelCase with Hungarian notation prefix for the type of the control, i.e. tbxMyTextBox, cbMyCheckBox, btnMyButtonabbreviations (public): PascalCase (e.g. Id rather than ID, Bmp rather that BMP)

On Saturday, June 26, 2021, 10:23:55 AM GMT+10, MurrayForbes ***@***.***> wrote:  

Okay, renamed.

I’ve noticed there is a lot of messages for words that violate the naming rules, for example ‘Naming rule violation: these words must begin with upper case characters frmLightCurve_FormClosed’.

I think I missed my naming violation in the forest of similar messages.

Cheers, Murray.

Sent from Mail for Windows 10

From: hpavlov Sent: Thursday, 24 June 2021 9:49 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

@hpavlov commented on this pull request.

In Tangra 3/VideoOperations/LightCurves/frmLightCurve.cs:

Bitmap bmp = AddImageLegend();

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub, or unsubscribe.

MurrayForbes commented 3 years ago

Hristo,

Your approach sounds better than what I did. However, I haven’t been able to find the name of the video file (I find lots of m_fileName or similar but none seem to be the right one and/or not accessible in my method).

Cheers, Murray.

Sent from Mail for Windows 10

From: hpavlov Sent: Thursday, 24 June 2021 9:43 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

@hpavlov commented on this pull request.

In Tangra 3/VideoOperations/LightCurves/frmLightCurve.cs:

  • saveImageDialog.FileName,
  • GetImageFormatFromFileExtension(Path.GetExtension(saveImageDialog.FileName)));
  • }
  • saveImageDialog.FileName,
  • GetImageFormatFromFileExtension(file_ext));
  • SaveLastUsedSaveAsImageFormat(file_ext);
  • }
  • }
  • private void SetSaveAsImageFormatToLastUsed()
  • {
  • switch (TangraConfig.Settings.Generic.SaveAsImageFileType)
  • {
  • case TangraConfig.SaveAsImageFormat.Bmp: Changing the order of the filter is not really necessary. A better approach would be to use a single filter, but based on the saved setting to auto-suggest the file name with a different extension i.e. to set saveImageDialog.FileName before opening the dialog. The name of the file could be the name of the video files with the corresponding extension. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
hpavlov commented 3 years ago

Should be accessible via TangraContext.Current.FileName (I think*)

On Saturday, June 26, 2021, 8:07:36 PM GMT+10, MurrayForbes ***@***.***> wrote:  

Hristo,

Your approach sounds better than what I did. However, I haven’t been able to find the name of the video file (I find lots of m_fileName or similar but none seem to be the right one and/or not accessible in my method).

Cheers, Murray.

Sent from Mail for Windows 10

From: hpavlov Sent: Thursday, 24 June 2021 9:43 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

@hpavlov commented on this pull request.

In Tangra 3/VideoOperations/LightCurves/frmLightCurve.cs:

  • saveImageDialog.FileName,
  • GetImageFormatFromFileExtension(Path.GetExtension(saveImageDialog.FileName)));
  • }
  • saveImageDialog.FileName,
  • GetImageFormatFromFileExtension(file_ext));
  • SaveLastUsedSaveAsImageFormat(file_ext);
  • }
  • }
  • private void SetSaveAsImageFormatToLastUsed()
  • {
  • switch (TangraConfig.Settings.Generic.SaveAsImageFileType)
  • {
  • case TangraConfig.SaveAsImageFormat.Bmp: Changing the order of the filter is not really necessary. A better approach would be to use a single filter, but based on the saved setting to auto-suggest the file name with a different extension i.e. to set saveImageDialog.FileName before opening the dialog. The name of the file could be the name of the video files with the corresponding extension. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub, or unsubscribe.

MurrayForbes commented 3 years ago

Hristo,

Yes, that was it. I’ll push this in a few minutes.

I could probably do the same thing (auto-suggesting the file name ) for the CSV and LC files as well?

Cheers, Murray.

Sent from Mail for Windows 10

From: hpavlov Sent: Saturday, 26 June 2021 11:08 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

Should be accessible via TangraContext.Current.FileName (I think*)

On Saturday, June 26, 2021, 8:07:36 PM GMT+10, MurrayForbes @.***> wrote:

Hristo,

Your approach sounds better than what I did. However, I haven’t been able to find the name of the video file (I find lots of m_fileName or similar but none seem to be the right one and/or not accessible in my method).

Cheers, Murray.

Sent from Mail for Windows 10

From: hpavlov Sent: Thursday, 24 June 2021 9:43 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

@hpavlov commented on this pull request.

In Tangra 3/VideoOperations/LightCurves/frmLightCurve.cs:

  • saveImageDialog.FileName,
  • GetImageFormatFromFileExtension(Path.GetExtension(saveImageDialog.FileName)));
  • }
  • saveImageDialog.FileName,
  • GetImageFormatFromFileExtension(file_ext));
  • SaveLastUsedSaveAsImageFormat(file_ext);
  • }
  • }
  • private void SetSaveAsImageFormatToLastUsed()
  • {
  • switch (TangraConfig.Settings.Generic.SaveAsImageFileType)
  • {
  • case TangraConfig.SaveAsImageFormat.Bmp: Changing the order of the filter is not really necessary. A better approach would be to use a single filter, but based on the saved setting to auto-suggest the file name with a different extension i.e. to set saveImageDialog.FileName before opening the dialog. The name of the file could be the name of the video files with the corresponding extension. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

hpavlov commented 3 years ago

Hi Murray,

I could probably do the same thing (auto-suggesting the file name ) for the CSV and LC files as well? This has been already done for those cases I believe, but please check and implement it if not working that way. Hristo.

On Sunday, June 27, 2021, 6:03:05 AM GMT+10, MurrayForbes ***@***.***> wrote:  

Hristo,

Yes, that was it. I’ll push this in a few minutes.

I could probably do the same thing (auto-suggesting the file name ) for the CSV and LC files as well?

Cheers, Murray.

Sent from Mail for Windows 10

From: hpavlov Sent: Saturday, 26 June 2021 11:08 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

Should be accessible via TangraContext.Current.FileName (I think*)

On Saturday, June 26, 2021, 8:07:36 PM GMT+10, MurrayForbes @.***> wrote:

Hristo,

Your approach sounds better than what I did. However, I haven’t been able to find the name of the video file (I find lots of m_fileName or similar but none seem to be the right one and/or not accessible in my method).

Cheers, Murray.

Sent from Mail for Windows 10

From: hpavlov Sent: Thursday, 24 June 2021 9:43 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

@hpavlov commented on this pull request.

In Tangra 3/VideoOperations/LightCurves/frmLightCurve.cs:

  • saveImageDialog.FileName,
  • GetImageFormatFromFileExtension(Path.GetExtension(saveImageDialog.FileName)));
  • }
  • saveImageDialog.FileName,
  • GetImageFormatFromFileExtension(file_ext));
  • SaveLastUsedSaveAsImageFormat(file_ext);
  • }
  • }
  • private void SetSaveAsImageFormatToLastUsed()
  • {
  • switch (TangraConfig.Settings.Generic.SaveAsImageFileType)
  • {
  • case TangraConfig.SaveAsImageFormat.Bmp: Changing the order of the filter is not really necessary. A better approach would be to use a single filter, but based on the saved setting to auto-suggest the file name with a different extension i.e. to set saveImageDialog.FileName before opening the dialog. The name of the file could be the name of the video files with the corresponding extension. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub, or unsubscribe.

MurrayForbes commented 3 years ago

Hristo,

No, it wasn’t already done (if it had been, I’d have used that code as a template and would have seen TangraContext.Current.FileName).

Anyway, I’ve amended the code for the lc, csv and emf file saves to use the video’s filename, and to override that if a lc file has been saved or loaded.

Cheers, Murray.

Sent from Mail for Windows 10

From: hpavlov Sent: Sunday, 27 June 2021 1:43 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

Hi Murray,

I could probably do the same thing (auto-suggesting the file name ) for the CSV and LC files as well? This has been already done for those cases I believe, but please check and implement it if not working that way. Hristo.

On Sunday, June 27, 2021, 6:03:05 AM GMT+10, MurrayForbes @.***> wrote:

Hristo,

Yes, that was it. I’ll push this in a few minutes.

I could probably do the same thing (auto-suggesting the file name ) for the CSV and LC files as well?

Cheers, Murray.

Sent from Mail for Windows 10

From: hpavlov Sent: Saturday, 26 June 2021 11:08 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

Should be accessible via TangraContext.Current.FileName (I think*)

On Saturday, June 26, 2021, 8:07:36 PM GMT+10, MurrayForbes @.***> wrote:

Hristo,

Your approach sounds better than what I did. However, I haven’t been able to find the name of the video file (I find lots of m_fileName or similar but none seem to be the right one and/or not accessible in my method).

Cheers, Murray.

Sent from Mail for Windows 10

From: hpavlov Sent: Thursday, 24 June 2021 9:43 p.m. To: hpavlov/tangra3 Cc: MurrayForbes; Author Subject: Re: [hpavlov/tangra3] Save light curve default image file format(#22)

@hpavlov commented on this pull request.

In Tangra 3/VideoOperations/LightCurves/frmLightCurve.cs:

  • saveImageDialog.FileName,
  • GetImageFormatFromFileExtension(Path.GetExtension(saveImageDialog.FileName)));
  • }
  • saveImageDialog.FileName,
  • GetImageFormatFromFileExtension(file_ext));
  • SaveLastUsedSaveAsImageFormat(file_ext);
  • }
  • }
  • private void SetSaveAsImageFormatToLastUsed()
  • {
  • switch (TangraConfig.Settings.Generic.SaveAsImageFileType)
  • {
  • case TangraConfig.SaveAsImageFormat.Bmp: Changing the order of the filter is not really necessary. A better approach would be to use a single filter, but based on the saved setting to auto-suggest the file name with a different extension i.e. to set saveImageDialog.FileName before opening the dialog. The name of the file could be the name of the video files with the corresponding extension. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.