Re: Re: [modified]patch file_Implement progress bar in windows_chenxiajian

From: Martin Sevior <msevior_at_gmail.com>
Date: Thu Apr 14 2011 - 06:55:38 CEST

Sorry for the SPAM everyone. Instead of:

> HOWEVER in this case you need percentLoad or the call:
>
> m_pStatusBar->setPercent(percentFilled);
>

 I meant to say:

> HOWEVER in this case you DON'T need percentLoad or the call:
>
> m_pStatusBar->setPercent(percentFilled);
>

Cheers

Martin

2011/4/14 Martin Sevior <msevior@gmail.com>:
> Hi Chen,
>
> Thankyou for your contributions. I really appreciate how quickly you
> are picking everything up.
>
> I have a few more comments.
>
> Firstly, when we define class member variables, we prepend an "m_" to
> their names. So if you create a new member variable "percentLoad" call
> is "m_percentLoad" instead.
>
> HOWEVER in this case you need percentLoad or the call:
>
> m_pStatusBar->setPercent(percentFilled);
>
> in the fl_DocListener class.
>
> Simply use the the existing method:
>
> double AP_StatusBarField_ProgressBar::getFraction(void)
>
> Which returns a double between 0.0 and 1.0 of the fraction of the
> progress completed.
>
> The code I wrote in fl_DocListedner already does what is needed to
> make sure getFraction returns a valid number.
>
> So your code in the ap_Win32StatusBar::notify method would be:
>
> int percent = textInfo->getApStatusBar()->getFraction()*100;
> SendMessage(m_pSB->getProgressBar(),PBM_SETPOS,percent,0)
>
> So please remove the getPercent, setPercent methods from the code and
> just use the getFraction method.
>
> Cheers
>
> Martin
> On Thu, Apr 14, 2011 at 2:13 PM, chenxiajian1985
> <chenxiajian1985@gmail.com> wrote:
>> Hi, Martin
>> the attachment is the modified patch file follows your instruction. I have tested in my computer, it works well.
>> I have modified as following:
>> 1 the implementation of the virtual function
>> void AP_Win32StatusBar::showProgressBar(void)
>> {
>> ShowWindow(m_hwndProgressBar,SW_SHOW);
>> }
>> void AP_Win32StatusBar::hideProgressBar(void)
>> {
>> ShowWindow(m_hwndProgressBar,SW_HIDE);
>> SendMessage(m_hwndProgressBar,PBM_SETPOS,0,0); //hide and set to zero
>> }
>>
>> 2 modify some member variable(no need pass by the paramter and just get from the "this" pointer)
>>
>>
>> We can use the progress bar: set the "percent" variable when set the status Bar text (m_sBuf)
>>
>> If have some problem about the patch, and some other bug in Windows, pls tell me. I would like to fix it
>>
>> Thanks
>> Chen Xiajian
>>
>>
>> 发件人: Martin Sevior
>> 发送时间: 2011-04-14 08:34:49
>> 收件人: chenxiajian1985
>> 抄送: abiword-dev
>> 主题: Re: patch file_Implement progress bar in windows_chenxiajian
>>
>> Hi Chen,
>> Thanks very much for this! Looking at your code, it appears that you
>> automatically hide the progress bar after it has reached either 50% or
>> 100%.
>> Instead of that please implement the following virtual methods for
>> AP_Win32StatusBar.
>> virtual void showProgressBar(void) {}
>> virtual void hideProgressBar(void) {}
>> The implementation in the gtk build is really simple.
>> void AP_UnixStatusBar::showProgressBar(void)
>> {
>> gtk_widget_show(m_wProgressFrame);
>> }
>> void AP_UnixStatusBar::hideProgressBar(void)
>> {
>> gtk_widget_hide(m_wProgressFrame);
>> }
>> Where m_wProgressFrame is the container that holds the progress bar. I
>> imagine Win32 has similar functionality?
>> (I'm not a windows developer!)
>> The cross platform code will show and and hide the progress bars as
>> needed and has already been written.
>> Finally, we can indeed use these for other situations in abiword later :-)
>> Cheers
>> Martin
>> 2011/4/14 chenxiajian1985 <chenxiajian1985@gmail.com>:
>>> Hi, all
>>> the attachment is the patch file that I implemant progress bar in windows. I have checked in my computer it works well.
>>> the image shows the progress bar in windows:
>>> http://hi.csdn.net/attachment/201104/13/65043_1302717024x1D4.png
>>>
>>> I care about some factors when coding:
>>> 1. when resize the status bar, the progress bar must resize too
>>> 2. the basic function
>>> 3. use the win32 common ctrls, the same as the source code
>>> 4. the position of the progress bar
>>> 5. the show and hide when operation finish
>>> ....
>>>
>>> Anyone who some suggestion, pls tell me. I will make the function more excellent.
>>>
>>>
>>> Thanks
>>> chen xiajian
>>
>
Received on Thu Apr 14 06:56:21 2011

This archive was generated by hypermail 2.1.8 : Thu Apr 14 2011 - 06:56:21 CEST