Author Topic: Code-Formatter PB 10  (Read 158590 times)

0 Members and 2 Guests are viewing this topic.

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #30 on: November 15, 2011, 08:41:05 PM »
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
Code: [Select]
  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.


Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #31 on: November 15, 2011, 08:58:38 PM »
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.


Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1037
  • User-Rate: +30/-4
    • it-berater
Re: Code-Formatter PB 10
« Reply #32 on: November 15, 2011, 09:02:25 PM »
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.

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #33 on: November 15, 2011, 09:02:30 PM »
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

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #34 on: November 15, 2011, 09:06:40 PM »
Hi Theo,
 That's what we do hope that it will end well who do we work together
 regards Peter
« Last Edit: December 26, 2011, 10:18:12 AM by Peter Weis »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #35 on: November 16, 2011, 01:59:33 AM »
Peter,

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

Still looking good.


Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #36 on: November 16, 2011, 05:52:13 PM »
Hello,
small update

regards Peter
« Last Edit: December 26, 2011, 10:18:48 AM by Peter Weis »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #37 on: November 16, 2011, 06:53:26 PM »
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.

« Last Edit: November 16, 2011, 06:55:04 PM by Paul Elliott »

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #38 on: November 16, 2011, 08:22:07 PM »
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

Code: [Select]
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
« Last Edit: December 26, 2011, 10:19:32 AM by Peter Weis »

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #39 on: November 16, 2011, 08:51:25 PM »
Hello,
again little change.

Code: [Select]

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
« Last Edit: December 26, 2011, 10:20:04 AM by Peter Weis »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #40 on: November 16, 2011, 09:08:38 PM »
Peter,

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


Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #41 on: November 16, 2011, 09:38:46 PM »
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

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #42 on: November 17, 2011, 12:38:02 AM »
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.


Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #43 on: November 17, 2011, 01:22:00 AM »
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

Code: [Select]
$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 )

Code: [Select]
      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.


Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1037
  • User-Rate: +30/-4
    • it-berater
Re: Code-Formatter PB 10
« Reply #44 on: November 17, 2011, 08:55:01 AM »
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"?