Palette::Palette() {
used = 0;
allowRealization = false;
+ size = 100;
+ entries = new ColourPair[size];
}
Palette::~Palette() {
Release();
+ delete [] entries;
+ entries = 0;
}
void Palette::Release() {
used = 0;
+ delete [] entries;
+ size = 100;
+ entries = new ColourPair[size];
}
// This method either adds a colour to the list of wanted colours (want==true)
return;
}
- if (used < numEntries) {
- entries[used].desired = cp.desired;
- entries[used].allocated.Set(cp.desired.AsLong());
- used++;
+ if (used >= size) {
+ int sizeNew = size * 2;
+ ColourPair *entriesNew = new ColourPair[sizeNew];
+ for (int j=0; j<size; j++) {
+ entriesNew[j] = entries[j];
+ }
+ delete []entries;
+ entries = entriesNew;
+ size = sizeNew;
}
+
+ entries[used].desired = cp.desired;
+ entries[used].allocated.Set(cp.desired.AsLong());
+ used++;
} else {
for (int i=0; i < used; i++) {
if (entries[i].desired == cp.desired) {
virtual void FillRectangle(PRectangle rc, ColourAllocated back);
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern);
virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back);
+ virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
+ ColourAllocated outline, int alphaOutline, int flags);
virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back);
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource);
hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4);
}
+void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
+ ColourAllocated fill, int alphaFill,
+ ColourAllocated outline, int alphaOutline, int flags) {
+// ** TODO
+
+ RectangleDraw(rc, outline, fill);
+}
+
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
PenColour(fore);
BrushColour(back);
void Window::InvalidateAll() {
GETWIN(id)->Refresh(false);
- wxWakeUpIdle();
}
void Window::InvalidateRectangle(PRectangle rc) {
wxRect r = wxRectFromPRectangle(rc);
GETWIN(id)->Refresh(false, &r);
- wxWakeUpIdle();
}
void Window::SetFont(Font &font) {
bool unicodeMode;
int desiredVisibleRows;
int aveCharWidth;
- int maxStrWidth;
+ size_t maxStrWidth;
Point location; // Caret location at which the list is opened
wxImageList* imgList;
wxArrayInt* imgTypeMap;
//----------------------------------------------------------------------
ElapsedTime::ElapsedTime() {
- wxStartTimer();
+ wxLongLong localTime = wxGetLocalTimeMillis();
+ littleBit = localTime.GetLo();
+ bigBit = localTime.GetHi();
}
double ElapsedTime::Duration(bool reset) {
- double result = wxGetElapsedTime(reset);
+ wxLongLong prevTime(bigBit, littleBit);
+ wxLongLong localTime = wxGetLocalTimeMillis();
+ if(reset) {
+ littleBit = localTime.GetLo();
+ bigBit = localTime.GetHi();
+ }
+ wxLongLong duration = localTime - prevTime;
+ double result = duration.ToDouble();
result /= 1000.0;
return result;
}