• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

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.

Peter Weis

#45
Hello,
have now added a new button to do so. Auserd I have some things changed in the source code

Hi Paul can not do that in line 770 as the Phoenix overwrites

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




It had the added in Form1.inc


FUNCTION Form1_OnCreate _
  ( _
  BYVAL hWnd        AS DWORD, _ ' window handle
  BYVAL lptcs       AS DWORD, _ ' address of CREATESTRUCT structure
        lMsgResult  AS LONG _   ' value returned to message
  ) AS LONG
  IF LEN(fo.fspecin)= 0 OR LEN(fo.fspecout) = 0 THEN
    Control_Disable GetDlgItem (hWnd, %IDC_FORM1_TEXTBTNFORMAT)

  END IF

  SetWindowText GetDlgItem(hWnd, %IDC_FORM1_TEXTBTN3), $TEXTBTN3
  SetWindowText GetDlgItem(hWnd, %IDC_FORM1_TEXTBTNFORMAT), $TEXTBTNFORMAT
  SetWindowText GetDlgItem(hWnd, %IDCANCEL), $CANCEL



END FUNCTION


regards Peter

Paul Elliott

Peter,

Ok, I thought there was a better/different way but couldn't think of it at the time.
I didn't remember which parts Phoenix overwrites and which parts are user changeable.

Your way is better and opens up the possiblilty to redo ALL the buttons/labels in other languages
if you want to.


Peter Weis

#47
Hello,
've done something a little more fine tuning.
Program have donated an icon, I've also removed minor bugs in the program.



regards Peter

Paul Elliott

#48
Peter,

I'm seeing something odd in the output file.

No matter which bak option I choose the program doesn't create a bak in my specified directory.
It is ignoring my output directory & file name. Keeps saying that it can't find the file.
Who cares? This file will be WRITTEN.

But it keeps overwriting my input file with the formatted output.
And with it NOT creating a backup  there is a chance that my input file will be lost.

Just found over 60 fmt*.tmp files in my TEMP directory. Why are they still there?





Peter Weis

Hello Paul
I also do not like the formatting to 100%, but I can not break, and work simultaneously on one hundred sites. Times tomorrow would only do it with Bak file with time stamp. Was hoping you can help me a bit! Because the formatting is still a huge mistake that I have described two days ago in Forum

regards Peter

Peter Weis

I have not noticed because the temporary file will look but the morning after

regards Peter

Paul Elliott

#51
Something very odd going on here ( maybe some setup on my computer but no clue what  ).

I can not get a msgbox or messagebox to display.
as in
msgbox "some message"
or
MessageBox %NULL,"backup of " & fo.fspecin, "bkup", %MB_OK

I've tried both right after backing up ( remarked out the IF so it always does it )
and after opening for output.
Nothing shows.

Will switch back to PB WINApi to see if it changes.


Nope, not a hint of a messagebox on screen either way.
Very strange.



Theo Gottwald

Try adding %MB_TOPMOST to the flags. Maybe that solves your problem :-).

Paul Elliott

Found at least part of the problem.

I was looking in the main BAS file where the DoFormat function is called.

BUT it is also called from over in Form1.inc under a button click.

Plus the file names are set & reset & reset & set to the other all over the place.

Sorry but I am NOT debugging this.  I will wait on Peter to straighten it out.
Too many options and I'm tired ( been up 12 hours already today ).

I'll check back in tomorrow.


Paul Elliott

Peter,

Sorry about the nasty last response. I was tired and it had not been a good day.

I'll help as much as I can. It would help if you start putting modification comments at the beginning
of the source ( at least the main BAS but the form1.inc would be a good place also).

Now would be a good time to create a 2nd UDT with the variables needed to handle formatting
between the lines and the handles that are not user modifiable. If it's not on your user entry
pages then move it to this 2nd UDT. No need to save this 2nd UDT. BUT please zero it out when
entering DoFormat so you can run multiple files in 1 run of the program.

And somewhere in there, it would clean things up if you delete the temp file after you copy it to
the OUTPUT file name. It's not needed any more at that point.


I need to find a better source file comparer. I've been using ExamDiff but it's having problems
syncing up when there are lots of changes. Maybe I'll have to check on a source-code-control
system. No sure yet.


Norbert Spoerl

Hello Paul,

>>>
I need to find a better source file comparer.
<<<
-> http://kdiff3.sourceforge.net/


Paul Elliott

Norbert,

Thanks. I like it and it syncs up much better than others that I've tried.

I had made many changes to field names and re-arranged the UDT and changed several routines
and it made the changes appear with no problem.

I think I'll uninstall the 2 others that are on my system and just use this one.


Peter Weis

#57
Hello,
Today I've since added the following resolved problem Bak function!



SUB CopyBak()
  LOCAL p, f, fout, d, t AS STRING

  f = PATHNAME$(NAME, fo.fspecin)
  IF fo.backup THEN
    IF fo.backupTimeStamp = 0 THEN
       p = PATHNAME$(PATH, fo.fspecin)
       fout = p + f + ".BAK"

        CopyFile fo.fspecin, (fout), 0
       ELSE
         p = PATHNAME$(PATH, fo.fspecin) + "BAK"
         IF ISFOLDER(p) = 0 THEN
            MKDIR p
            p = p + "\"
         END IF
         d = Built.DateString
         REPLACE "." WITH "_" IN d
         t = Built.TimeString
         REPLACE ":" WITH "_" IN t
                 
         CopyFile fo.fspecin, p + "\" + f + "_"+ d + " " + t + " .BAK", 0


       END IF
   END IF
END SUB



Peter Weis

Halo Paul,
  but you wanted to help me or something, DoFormat still needs many improvements
regards Peter

Theo Gottwald

Hallo Peter,

du hast ein Code angehängt. Arbeitet da jetzt noch jemand dran oder ist das erstmal dein Endstand?

Is actually somebody working on the Code or do we have some soert of FINAL?