Author Topic: Source Code Formatter: progress dialog?  (Read 5568 times)

Offline k1mgy

  • Multiple posting newcomer
  • *
  • Posts: 64
Source Code Formatter: progress dialog?
« on: November 23, 2005, 03:50:17 am »
The Source Code Formatter plugin (hope this is the right place for this) does not provide a progress dialog. 

Therefore, with large sources that take 15 seconds or so to complete, the wait can be unnerving.  Did it break?  Is it done?

I don't know.  When it finishes the cursor position is moved to the bottom of the viewport - that's the only way to tell.

I think it would be nice if this plugin provided a progress dialog (percentage, or line by line) and when it finishes, puts the cursor back to the same position and with the viewport aligned as it was.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Source Code Formatter: progress dialog?
« Reply #1 on: November 23, 2005, 09:02:33 am »
That one is kinda hard.

The plugin is using an external "library", which is AStyle. The plugin as it just takes all the text from the editor and sends it to AStyle. When AStyle is done it returns the formatted text. Now the plugin just replaces the text in the editor with the formatted one.

What I'm curious about is how long is that source file to make the plugin take 15 seconds to complete?

The only way I'm seeing to do that without modifying AStyle is to "fool" it with a really special kind of istream.

BTW, could you provide a sample source file that take long enough for testing purposes?

Offline k1mgy

  • Multiple posting newcomer
  • *
  • Posts: 64
Re: Source Code Formatter: progress dialog?
« Reply #2 on: November 23, 2005, 10:57:47 am »
I can't provide the source as most of it is proprietary.  Sorry.  But there is one possibility: I was tired, it was late, and I was wrong :)

I timed it, and the process takes 7 seconds to complete.  The file is 5226 lines long and is 150k in size.

Still, seems like a long time with no hourglass.

Can you set the hourglass?

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Source Code Formatter: progress dialog?
« Reply #3 on: November 23, 2005, 05:30:13 pm »
That one would be more viable :)

Ok, I've just tested it and was quite simple: 1 line :)

I'll commit it later if no one complains about... so... ppl... it's your turn to complain :)
« Last Edit: November 23, 2005, 05:38:39 pm by Ceniza »

Offline k1mgy

  • Multiple posting newcomer
  • *
  • Posts: 64
Re: Source Code Formatter: progress dialog?
« Reply #4 on: November 24, 2005, 08:14:02 pm »
Installed your binary (thanks for providing these) but no hourglass.
CodeBlocksCVS20051121.7z         21-Nov-2005 17:24   3.1M 

takeshimiya

  • Guest
Re: Source Code Formatter: progress dialog?
« Reply #5 on: November 24, 2005, 08:54:11 pm »
Seems like other things will need hourglass also.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Source Code Formatter: progress dialog?
« Reply #6 on: November 25, 2005, 03:24:26 am »
Quote from: k1mgy
Installed your binary (thanks for providing these) but no hourglass.

Oops! I totally forgot to add it to CVS :P

I'll try to get it ready for tomorrow, and maybe release another snapshot.