• Welcome to Theos PowerBasic Museum 2017.

Code-Formatter PB 10

Started by Theo Gottwald, January 18, 2011, 07:58:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Paul Elliott

Peter,

Yes, I agree that it does look ugly but that's what the original code produces.

It's moving the trailing remark to a new line but not taking into account that it is in the middle
of a bunch of continuation lines.

Increase fo.remcol by 15 to 20 and it should at least compile.

The code that produces this is

  IF LEN(comment) THEN
      IF LEN(stemp) < fo.remcol THEN
         stemp = LEFT$(stemp + SPACE$(fo.RemCol - 1), fo.RemCol - 1) + comment
      ELSE
         w(0) = SPACE$(fo.indent) + comment
      END IF
   END IF 


which is at the end of Function RebuildLine.

It might be easiest to just append the comment even if beyond the remcol.
The choice can be yours but if you change it then do it in all places.


Paul Elliott

Peter,

CONGRATULATIONS!!!!!!!   IT COMPILES AND IT WORKS!!!!

Now for the little nit-picking things (  that you are probably already working on  )
1) some kind of option for different language on buttons.
2) put a progress bar on your form instead of that pop-up.
3) add inClass as long to formsoption UDT and use the Function RebuildLine from v2c that I posted.
I don't think I changed anything outside that function.
4) increase version number.

Haven't tried saving/loading options yet.

Once again, Congratulations.


Theo Gottwald

Looks like we'll soon have a good "Pretty Printer for PB 10" as our first community project.

Let's stay together and make more projects.

Peter Weis

Hi Paul,

What have you changed just let me know! So I can include it in my'm still busy with the IDE and have little time right now! Four things must change

Once the time stamp for files Bak

Call for the output file

And you can call it from another program with call

Secondly, I want to put the ProgressBar in the StatusBar

regards Peter

Peter Weis

#34
Hi Theo,
That's what we do hope that it will end well who do we work together
regards Peter

Paul Elliott

Peter,

Aha! You snuck an update in while I was trying to remember how to set up Phoenix.

Still looking good.


Peter Weis

#36
Hello,
small update

regards Peter

Paul Elliott

#37
Peter,

A small suggestion.  Put comments at the top of the BAS file ( and maybe the FRM/INC ) as to
date/time updated and major changes.  Seems that Phoenix is updating the date/time stamp
on all files even if no changes made. Maybe even upping the version by .1 or .01 each time
you post a new archive.

Just so that we can tell we're all using the same version of the program & sources.
By the way, what is your time compared to the time at this forum?
For me, the forum is 6 hours ahead.

Thanks.


Peter Weis

#38
Hello,
I just grabbed the folder, and because the order "CodeFormatter PB9 v2a" means the name is born!

I now only the error of the output file button changed


FUNCTION Form1_TextBtnOutoutFile_Clicked _
  ( _
  BYVAL hWndParent  AS DWORD, _ ' handle of parent window
  BYVAL hWndCtrl    AS DWORD _  ' handle of control
  ) AS LONG
  DISPLAY OpenFile hWndParent, 0, 0, "Format Powerbasic Code", "", _
      CHR$( "Basic Source [BAS, INC]", 0, "*.BAS;*.INC", 0), _
      "", "", %OFN_FILEMUSTEXIST TO fo.fspecout
  IF LEN(fo.fspecout) <> 0 THEN

    zSetCTLText(GetDlgItem(hWndParent, %IDC_FORM1_EDIT_FILE_OUTPUT), fo.fspecout)
    Control_Enable GetDlgItem (mainhWnd, %IDC_FORM1_TEXTBTNFORMAT)

  END IF

END FUNCTION





regards Peter

Peter Weis

#39
Hello,
again little change.



FUNCTION Form1_TextBtnOutoutFile_Clicked _
  ( _
  BYVAL hWndParent  AS DWORD, _ ' handle of parent window
  BYVAL hWndCtrl    AS DWORD _  ' handle of control
  ) AS LONG
  DISPLAY OpenFile hWndParent, 0, 0, "Format Powerbasic Code", "", _
      CHR$( "Basic Source [BAS, INC]", 0, "*.BAS;*.INC", 0), _
      "", "", %OFN_FILEMUSTEXIST TO fo.fspecout
  IF LEN(fo.fspecout) <> 0 THEN

    zSetCTLText(GetDlgItem(hWndParent, %IDC_FORM1_EDIT_FILE_OUTPUT), fo.fspecout)
    IF LEN(fo.fspecin) THEN
      Control_Enable GetDlgItem (mainhWnd, %IDC_FORM1_TEXTBTNFORMAT)
    ELSE
      Control_Disable GetDlgItem (mainhWnd, %IDC_FORM1_TEXTBTNFORMAT) 
    END IF
  END IF

END FUNCTION



regards Peter

Paul Elliott

Peter,

You do know you can easily change the directory name with Explorer? Just click then press F2.


Peter Weis

Hi Paul,
that's true and that's what I know. But then I have to look for the PHOENIX project again, whom I would like to open it.

regards Peter

Paul Elliott

Peter,

Finding the project in the new directory is a simple matter and only needs to be done once.
I setup a project in Phoenix for this & added the files/forms and moved the whole thing
3 times so far. Easy and I haven't used Phoenix  in around 4 years.


Paul Elliott

Peter,

Back on a previous note, I added 6 lines to allow easy changing of text on the page 1 buttons.

Before PHNX_BEGIN_CONSTANTS


$TEXTBTN3      = "&Help"
$TEXTBTNFORMAT = "&Format"
$CANCEL        = "E&xit"


and down around line #770 or so where you create the 3 buttons
put 1 line of code after you set the font ( 1 for each button )


      SetWindowText hWndChild, $TEXTBTN3
      SetWindowText hWndChild, $TEXTBTNFORMAT
      SetWindowText hWndChild, $CANCEL


That way you can easily change the button labels for different languages.
Even though you did use English for all the rest of buttons & labels & such.


Theo Gottwald

Quote from: Jim Dunn on November 16, 2011, 07:10:34 PM
And the most recent file says "v2a"... but 3 posts back it says "v2d"...

Which is the latest?

Yes, and maybe can you also change the name in "Codeformatter PB 10"?