[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : alex
Repository : xara
Revision : 984
Date : Tue May 9 19:04:55 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/statline.cpp
M /Trunk/XaraLX/wxOil/xrc/EN/statusbar.xrc
More status/progress work
Diff:
Index: Trunk/XaraLX/Kernel/statline.cpp
===================================================================
--- Trunk/XaraLX/Kernel/statline.cpp (revision 983)
+++ Trunk/XaraLX/Kernel/statline.cpp (revision 984)
@@ -1284,59 +1284,34 @@
BOOL StatusLine::ShowProgress (BOOL Show, String_64 *JobDescrip)
{
- BOOL Invalidate=(Show != ProgressShown);
- BOOL FirstShow=(Show && !ProgressShown);
- // Get rid of any old text
- if (JobDescription)
- {
- delete JobDescription;
- JobDescription=NULL;
- }
-
- CurrentPercent = -1;
- if (JobDescrip == NULL)
- JobDescription = NULL;
- else
- JobDescription = new String_64(*JobDescrip);
+ BOOL ShowChanged=(Show != ProgressShown);
- if (JobDescription && Show)
- {
- SetStringGadgetValue(_R(IDC_SL_PROGRESSTEXT), *JobDescription);
- Invalidate=TRUE;
- }
- else
- {
- SetStringGadgetValue(_R(IDC_SL_PROGRESSTEXT), String_64(_T("")));
- Invalidate=TRUE;
- }
+ String_64 EmptyString(_T(""));
- if (0 && Invalidate)
- {
- EnableGadget(_R(IDC_SL_PROGRESSGAUGE), Show);
- EnableGadget(_R(IDC_SL_PROGRESSTEXT), Show);
- InvalidateGadget(_R(IDC_SL_PROGRESSTEXT));
- InvalidateGadget(_R(IDC_SL_PROGRESSGAUGE));
- PaintGadgetNow(_R(IDC_SL_PROGRESSTEXT));
- PaintGadgetNow(_R(IDC_SL_PROGRESSGAUGE));
- InvalidateGadget(0);
- PaintGadgetNow(0); // repaint the whole bar
- PaintGadgetNow(0); // repaint the whole bar
- }
+ // Make "NULL" mean "empty string"
+ if (!JobDescrip)
+ JobDescrip=&EmptyString;
-// InvalidateGadget(0);
-// PaintGadgetNow(0);
- InvalidateGadget(_R(IDC_SL_PROGRESSGAUGE), TRUE);
- PaintGadgetNow(_R(IDC_SL_PROGRESSGAUGE));
+ BOOL StringChanged=!JobDescription || (*JobDescription!=*JobDescrip);
- ProgressShown=Show;
+ // Return if nothing changed
+ if (!ShowChanged && !StringChanged)
+ return TRUE;
- if (FirstShow)
+ if (ShowChanged)
{
+ HideGadget(_R(IDC_SL_PROGRESSTEXT), !Show);
+ HideGadget(_R(IDC_SL_PROGRESSGAUGE), !Show);
+ HideGadget(_R(IDC_SL_PROGRESSPERCENT), !Show);
+
+ ProgressShown=Show;
+
CurrentPercent=-1; // Force a redraw
- SetPercent(0, TRUE); // Force redraw of window _including background_
+ SetPercent(0, TRUE, JobDescrip); // Force redraw of window _including background_; always refresh string
+ return TRUE;
}
- return TRUE;
+ return SetPercent(CurrentPercent, StringChanged, StringChanged?JobDescrip:NULL);
}
@@ -1380,6 +1355,11 @@
CurrentPercent = NewPercent;
+ String_64 PercentString;
+ PercentString.MakePercent(CurrentPercent);
+ SetStringGadgetValue(_R(IDC_SL_PROGRESSPERCENT), PercentString);
+ SetLongGadgetValue(_R(IDC_SL_PROGRESSGAUGE), CurrentPercent);
+
// If there is a new Job Description, change to use it
if (JobDescrip != NULL)
{
@@ -1395,20 +1375,17 @@
SetStringGadgetValue(_R(IDC_SL_PROGRESSTEXT), String_64(_T("")));
}
-// InvalidateGadget(_R(IDC_SL_PROGRESSTEXT));
-// PaintGadgetNow(_R(IDC_SL_PROGRESSTEXT));
-
- ClearBackground = TRUE; // Ensure that the new text is drawn
+ InvalidateGadget(0, TRUE); // Repaint the whole bar
+ PaintGadgetNow(0);
}
+ else
+ {
+ // Just repaint the gauge
+ InvalidateGadget(_R(IDC_SL_PROGRESSGAUGE), ClearBackground);
+ InvalidateGadget(_R(IDC_SL_PROGRESSPERCENT), ClearBackground);
+ PaintGadgetNow(_R(IDC_SL_PROGRESSGAUGE));
+ PaintGadgetNow(_R(IDC_SL_PROGRESSPERCENT));
+ }
- SetLongGadgetValue(_R(IDC_SL_PROGRESSGAUGE), CurrentPercent);
-// InvalidateGadget(_R(IDC_SL_PROGRESSGAUGE), ClearBackground);
-// PaintGadgetNow(_R(IDC_SL_PROGRESSGAUGE));
-// InvalidateGadget(0, ClearBackground);
-// PaintGadgetNow(0); // repaint the whole bar
-
- InvalidateGadget(_R(IDC_SL_PROGRESSGAUGE), ClearBackground);
- PaintGadgetNow(_R(IDC_SL_PROGRESSGAUGE));
-
return(TRUE);
}
Index: Trunk/XaraLX/wxOil/xrc/EN/statusbar.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/statusbar.xrc (revision 983)
+++ Trunk/XaraLX/wxOil/xrc/EN/statusbar.xrc (revision 984)
@@ -30,12 +30,18 @@
</object>
<object class="sizeritem">
- <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
+ <flag>wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
<border>1</border>
- <object class="wxGauge" name="IDC_SL_PROGRESSGAUGE">
- <size>-1,12</size>
- <value>50</value>
- <range>100</range>
+ <option>1000</option>
+ <object class="wxStaticText" name="IDC_SL_PROGRESSTEXT">
+ <hidden>1</hidden>
+ <font>
+ <size>8</size>
+ </font>
+ <style>wxALIGN_RIGHT</style>
+ <label>Nothing selected</label>
+ <tooltip>Status bar text</tooltip>
+ <help>Displays the current status</help>
</object>
</object>
@@ -46,14 +52,25 @@
</object>
<object class="sizeritem">
+ <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
+ <border>1</border>
+ <object class="wxGauge" name="IDC_SL_PROGRESSGAUGE">
+ <hidden>1</hidden>
+ <size>-1,12</size>
+ <value>50</value>
+ <range>100</range>
+ </object>
+ </object>
+ <object class="sizeritem">
<flag>wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
<border>1</border>
- <object class="wxStaticText" name="IDC_SL_PROGRESSTEXT">
+ <object class="wxStaticText" name="IDC_SL_PROGRESSPERCENT">
+ <hidden>1</hidden>
<font>
<size>8</size>
</font>
<style>wxALIGN_LEFT</style>
- <label>Nothing selected</label>
+ <label>00% </label>
<tooltip>Status bar text</tooltip>
<help>Displays the current status</help>
</object>
Xara