samples/thread/*.ico
samples/thread/*.txt
+samples/forty/*.cpp
+samples/forty/*.h
+samples/forty/makefile*
+samples/forty/*.rc
+samples/forty/*.def
+samples/forty/*.bmp
+samples/forty/*.xpm
+samples/forty/*.xbm
+samples/forty/*.png
+samples/forty/*.ico
+samples/forty/*.txt
+
samples/dde/*.cpp
samples/dde/*.h
samples/dde/makefile*
- wxRadioBox sometimes doesn't show (e.g. in controls sample).
-- wxStaticText doesn't wrap.
+- Can't set the colours for the buttons in the file selector, for
+ some reason.
General:
--------
- Makefiles for more compilers and samples; Cygwin makefiles
rationalised.
-- Added DLL support to VC++ makefiles.
+- Added VC++ project file for compiling as DLL.
wxMotif:
+- Added OnEraseBackground invocation.
+- Added wxRETAINED implementation for wxScrolledWindow.
+- Cured scrolling display problem by adding XmUpdateDisplay.
+- Tried to make lex-ing in the makefile more generic (command line
+ syntax should apply to both lex and flex).
+- Changed file selector colours for consistency (except for buttons:
+ crashes for some reason).
+- Fixed wxMotif version of wxImage::ConvertToBitmap (used new instead
+ of malloc, which causes memory problems).
General:
- Further doc improvements.
- wxGenericValidator added.
-
+- Added wxImageModule to image.cpp, so adds/cleans up standard handlers
+ automatically.
Beta 3, January 31st 1999
-------------------------
- wxTextCtrl doesn't work as a stream buffer in Linux/gcc
- No wxSpinButton
- Need a way of specifying default settings for colour/font/etc.
-- More optimisation could be done to reduce X server traffic, etc.
\ No newline at end of file
+- More optimisation could be done to reduce X server traffic, etc.
+- Should scrollbars take on the background colour? Not right for
+ e.g. wxScrolledWindows, so maybe have wxSystemSettings value for
+ scrollbar colour, and/or ability to set scrollbar colour independently.
+
wxMotif TODO
------------
-Updated: 28/12/98
+Updated: 11/02/99
-------------------------------o-------------------------
- Have a central/per app file for colour settings, with a wxWin
app to allow changing settings interactively.
-- Colour setting in widgets (almost done). Should scrollbars take
- on the background colour? Not right for e.g. wxScrolledWindows,
- so maybe have wxSystemSettings value for scrollbar colour, and/or
- ability to set scrollbar colour independently.
-
-- Optimize wxWindow OnPaint to avoid flicker, collapsing Expose events
- as per flicker fix in 1.68. It will be tricky to avoid
- interfering with non-wxScrolledWindow widgets except by
- explicitly testing for wxScrolledWindow.
-
-- Implementation of OnEraseBackground. How? Call OnEraseBackground
- just before OnPaint? Will duplicate Xlib's own erase of the background.
- However, this is usually OK, because the default wxWindow::OnEraseBackground
- can do nothing (SetBackgroundColour will make the background look OK).
- And if a custom OnEraseBackground uses the same colour as the window
- background, no flicker will be seen. If it does something else, such as
- painting a tiled bitmap, then a slight flicker might be seen unless
- X can be persuaded not to repaint the window background by default.
+- Implementation of default event processing (i.e. passing on an intercepted
+ event such as OnChar to the system). Currently, such events are processed
+ anyway, so for example intercepting left-click in a widget doesn't disable
+ the default behaviour. See TODOs in window.cpp.
- wxRadioBox doesn't show up in the controls sample, though it's
OK on other dialogs (e.g. printing sample).
- Use wxImage to load other formats into wxBitmaps, such as PNG, BMP.
-- Implement scaled Blit as per John Price's impementation for 1.68.
-
Low Priority
------------
+- Painting a retained window could be optimized further (see
+ wxWindow::DoPaint).
+
- Visuals: how to select an appropriate one? See Thomas Runge's
visual patch for 1.68 -- should be straightforward to port to 2.0.
when implemented as extra bitmap handlers, the code won't be linked
unless needed. Update: see if wxImage can handle these formats.
-- Enhance event handling such that you override e.g. left-click
- and unless you call the base OnMouseEvent, the click won't be
- sent to the button. Required for Dialog Editor.
-
-- Get Dialog Editor working under Motif.
+- Get Dialog Editor working (better) under Motif.
- New wxHelp version: try using the XmHTML widget at
http://www.xs4all.nl/~ripley/XmHTML/.
- Miscellaneous classes e.g. wxJoystick (identical to GTK's one for
Linux)
-- Blit scaling
-
- Get ODBC classes and sample working.
- Work out why wxTextCtrl doesn't work as a stream buffer under
void SetDCClipping (); // Helper function for setting clipping
inline WXGC GetGC() const { return m_gc; }
+ inline WXGC GetBackingGC() const { return m_gcBacking; }
inline WXDisplay* GetDisplay() const { return m_display; }
inline bool GetAutoSetting() const { return m_autoSetting; }
inline void SetAutoSetting(bool flag) { m_autoSetting = flag; }
public:
/// Motif-specific
+ bool m_needsRefresh; // Do we need to repaint the backing store?
bool m_canAddEventHandler;
bool m_button1Pressed;
bool m_button2Pressed;
const wxPoint &pos, const wxSize &size )
: wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER )
{
+ my_horse = (wxBitmap*) NULL;
+ my_square = (wxBitmap*) NULL;
+ my_anti = (wxBitmap*) NULL;
+
SetBackgroundColour(* wxWHITE);
wxBitmap bitmap( 100, 100 );
image.LoadFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG );
my_square = new wxBitmap( image.ConvertToBitmap() );
-
+
CreateAntiAliasedBitmap();
}
{
wxPaintDC dc( this );
PrepareDC( dc );
-
+
dc.DrawText( "Loaded image", 30, 10 );
- if (my_square->Ok()) dc.DrawBitmap( *my_square, 30, 30 );
+ if (my_square && my_square->Ok()) dc.DrawBitmap( *my_square, 30, 30 );
dc.DrawText( "Drawn directly", 150, 10 );
dc.SetBrush( wxBrush( "orange", wxSOLID ) );
dc.SetPen( *wxWHITE_PEN );
dc.DrawRectangle( 150, 30, 100, 100 );
- if (my_anti->Ok()) dc.DrawBitmap( *my_anti, 250, 140 );
+ if (my_anti && my_anti->Ok()) dc.DrawBitmap( *my_anti, 250, 140 );
- if (my_horse->Ok()) dc.DrawBitmap( *my_horse, 30, 140 );
+ if (my_horse && my_horse->Ok()) dc.DrawBitmap( *my_horse, 30, 140 );
}
void MyCanvas::CreateAntiAliasedBitmap()
{
wxBitmap bitmap( 300, 300 );
+
wxMemoryDC dc;
+
dc.SelectObject( bitmap );
-
+
dc.Clear();
dc.SetFont( wxFont( 24, wxDECORATIVE, wxDEFAULT, wxDEFAULT ) );
wxImage original( bitmap );
wxImage anti( 150, 150 );
-
+
/* This is quite slow, but safe. Use wxImage::GetData() for speed instead. */
for (int y = 1; y < 149; y++)
bool MyApp::OnInit()
{
- wxImage::AddHandler( new wxPNGHandler );
-
wxFrame *frame = new MyFrame();
frame->Show( TRUE );
#include "wx/filefn.h"
#include "wx/wfstream.h"
#include "wx/intl.h"
+#include "wx/module.h"
#ifdef __SALFORDC__
#ifdef FAR
wxBitmap bitmap;
wxCHECK_MSG( Ok(), bitmap, "invalid image" );
-
+
int width = GetWidth();
int height = GetHeight();
// Create image
XImage *data_image = XCreateImage( dpy, vis, bpp, ZPixmap, 0, 0, width, height, 32, 0 );
- data_image->data = new char[ data_image->bytes_per_line * data_image->height ];
+ data_image->data = (char*) malloc( data_image->bytes_per_line * data_image->height );
bitmap.Create( width, height, bpp );
-
+
/*
// Create mask
}
XFree( vi );
-
+
if ((bpp == 16) && (vi->red_mask != 0xf800)) bpp = 15;
if (bpp < 8) bpp = 8;
*/
}
#endif
+
+// A module to allow wxImage initialization/cleanup
+// without calling these functions from app.cpp or from
+// the user's application.
+
+class wxImageModule: public wxModule
+{
+DECLARE_DYNAMIC_CLASS(wxImageModule)
+public:
+ wxImageModule() {}
+ bool OnInit() { wxImage::InitStandardHandlers(); return TRUE; };
+ void OnExit() { wxImage::CleanUpHandlers(); };
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxImageModule, wxModule)
+
#include "windows.h"
#endif
+#ifdef __WXMOTIF__
+// For wxRETAINED implementation
+#include <Xm/Xm.h>
+#endif
+
wxScrolledWindow::wxScrolledWindow(void)
{
m_xScrollPixelsPerLine = 0;
m_yScrollPosition = yPos;
m_xScrollLines = noUnitsX;
m_yScrollLines = noUnitsY;
+
+#ifdef __WXMOTIF__
+ // Sorry, some Motif-specific code to implement a backing pixmap
+ // for the wxRETAINED style. Implementing a backing store can't
+ // be entirely generic because it relies on the wxWindowDC implementation
+ // to duplicate X drawing calls for the backing pixmap.
+
+ if ((m_windowStyle & wxRETAINED) == wxRETAINED)
+ {
+ Display* dpy = XtDisplay((Widget) GetMainWidget());
+
+ int totalPixelWidth = m_xScrollLines * m_xScrollPixelsPerLine;
+ int totalPixelHeight = m_yScrollLines * m_yScrollPixelsPerLine;
+ if (m_backingPixmap &&
+ !((m_pixmapWidth == totalPixelWidth) &&
+ (m_pixmapHeight == totalPixelHeight)))
+ {
+ XFreePixmap (dpy, (Pixmap) m_backingPixmap);
+ m_backingPixmap = (WXPixmap) 0;
+ }
+
+ if (!m_backingPixmap &&
+ (noUnitsX != 0) && (noUnitsY != 0))
+ {
+ int depth = wxDisplayDepth();
+ m_pixmapWidth = totalPixelWidth;
+ m_pixmapHeight = totalPixelHeight;
+ m_backingPixmap = (WXPixmap) XCreatePixmap (dpy, RootWindow (dpy, DefaultScreen (dpy)),
+ m_pixmapWidth, m_pixmapHeight, depth);
+ }
+
+ }
+#endif
AdjustScrollbars();
{
if (!display) /* Must be called first with non-NULL display */
return m_mainColormap;
+
+ int defaultScreen = DefaultScreen((Display*) display);
+ Screen* screen = XScreenOfDisplay((Display*) display, defaultScreen);
- Colormap c =
- DefaultColormapOfScreen(XScreenOfDisplay((Display*) display,
- DefaultScreen((Display*) display)));
+ Colormap c = DefaultColormapOfScreen(screen);
if (!m_mainColormap)
m_mainColormap = (WXColormap) c;
#include "wx/dcmemory.h"
#include "wx/window.h"
#include "wx/app.h"
+#include "wx/image.h"
+
#include <math.h>
#include <Xm/Xm.h>
XGCValues valReturn;
XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn);
m_oldFont = (WXFont) valReturn.font;
+
+ SetBackground(wxBrush(m_window->GetBackgroundColour(), wxSOLID));
};
wxWindowDC::~wxWindowDC(void)
// last selected background color. [::SetBackground]
if (m_pen.Ok() && m_autoSetting)
SetPen (m_pen);
-
- if (m_pixmap && sourceDC->m_pixmap)
+
+ // Do bitmap scaling if necessary
+
+ wxBitmap *scaledBitmap = (wxBitmap*) NULL;
+ Pixmap sourcePixmap = (Pixmap) NULL;
+ double scaleX, scaleY;
+ GetUserScale(& scaleX, & scaleY);
+
+ // Sorry, can't scale masks just yet
+ if (!useMask && (scaleX != 1.0 || scaleY != 1.0) && sourceDC->IsKindOf(CLASSINFO(wxMemoryDC)))
+ {
+ wxMemoryDC* memDC = (wxMemoryDC*) sourceDC;
+ wxBitmap& bitmap = memDC->GetBitmap();
+
+ wxASSERT_MSG( (bitmap.Ok()), "Bad source bitmap in wxWindowDC::Blit");
+
+ wxImage image(bitmap);
+ if (!image.Ok())
+ {
+ sourcePixmap = (Pixmap) bitmap.GetPixmap();
+ }
+ else
+ {
+ int scaledW = (int) (bitmap.GetWidth() * scaleX);
+ int scaledH = (int) (bitmap.GetHeight() * scaleY);
+
+ image = image.Scale(scaledW, scaledH);
+ scaledBitmap = new wxBitmap(image.ConvertToBitmap());
+ sourcePixmap = (Pixmap) scaledBitmap->GetPixmap();
+ }
+ }
+ else
+ sourcePixmap = (Pixmap) sourceDC->m_pixmap;
+
+ if (m_pixmap && sourcePixmap)
{
/* MATTHEW: [9] */
int orig = m_logicalFunction;
if (m_window && m_window->GetBackingPixmap())
XCopyRemote((Display*) sourceDC->m_display, (Display*) m_display,
- (Pixmap) sourceDC->m_pixmap, (Pixmap) m_window->GetBackingPixmap(),
+ (Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),
(GC) m_gcBacking,
source->LogicalToDeviceX (xsrc),
source->LogicalToDeviceY (ysrc),
}
}
- XCopyRemote((Display*) sourceDC->m_display, (Display*) m_display, (Pixmap) sourceDC->m_pixmap, (Pixmap) m_pixmap, (GC) m_gc,
+ XCopyRemote((Display*) sourceDC->m_display, (Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_pixmap, (GC) m_gc,
source->LogicalToDeviceX (xsrc),
source->LogicalToDeviceY (ysrc),
source->LogicalToDeviceXRel(width),
// +++ MARKUS (mho@comnets.rwth-aachen): error on blitting bitmaps with depth 1
if (source->IsKindOf(CLASSINFO(wxMemoryDC)) && ((wxMemoryDC*) source)->GetBitmap().GetDepth() == 1)
{
- XCopyPlane ((Display*) m_display, (Pixmap) sourceDC->m_pixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ XCopyPlane ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
source->LogicalToDeviceX (xsrc),
source->LogicalToDeviceY (ysrc),
source->LogicalToDeviceXRel(width),
}
else
{
- XCopyArea ((Display*) m_display, (Pixmap) sourceDC->m_pixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ XCopyArea ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
source->LogicalToDeviceX (xsrc),
source->LogicalToDeviceY (ysrc),
source->LogicalToDeviceXRel(width),
if (source->IsKindOf(CLASSINFO(wxMemoryDC)) &&
((wxMemoryDC*)source)->GetBitmap().Ok() && (((wxMemoryDC*)source)->GetBitmap().GetDepth () == 1))
{
- XCopyPlane ((Display*) m_display, (Pixmap) sourceDC->m_pixmap, (Pixmap) m_pixmap, (GC) m_gc,
+ XCopyPlane ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_pixmap, (GC) m_gc,
source->LogicalToDeviceX (xsrc),
source->LogicalToDeviceY (ysrc),
source->LogicalToDeviceXRel(width),
}
else
{
- XCopyArea ((Display*) m_display, (Pixmap) sourceDC->m_pixmap, (Pixmap) m_pixmap, (GC) m_gc,
+ XCopyArea ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_pixmap, (GC) m_gc,
source->LogicalToDeviceX (xsrc),
source->LogicalToDeviceY (ysrc),
source->LogicalToDeviceXRel(width),
CalcBoundingBox (xdest + width, ydest + height);
SetLogicalFunction(orig);
+
+ if (scaledBitmap) delete scaledBitmap;
return TRUE;
}
+ if (scaledBitmap) delete scaledBitmap;
+
return FALSE;
};
return;
int pixel = m_backgroundBrush.GetColour().AllocColour(m_display);
-
+
+ // New behaviour, 10/2/99: setting the background brush of a DC
+ // doesn't affect the window background colour.
+/*
// XSetWindowBackground doesn't work for non-Window pixmaps
if (!this->IsKindOf(CLASSINFO(wxMemoryDC)))
XSetWindowBackground ((Display*) m_display, (Pixmap) m_pixmap, pixel);
+*/
// Necessary for ::DrawIcon, which use fg/bg pixel or the GC.
// And Blit,... (Any fct that use XCopyPlane, in fact.)
if (event -> xexpose.count == 0)
{
- wxPaintEvent event(win->GetId());
- event.SetEventObject(win);
- win->GetEventHandler()->ProcessEvent(event);
+ win->DoPaint();
win->ClearUpdateRects();
}
}
else
{
- keyEvent.SetEventType(wxEVT_CHAR);
- dialog->GetEventHandler()->ProcessEvent(keyEvent);
+ // For simplicity, OnKeyDown is the same as OnChar
+ // TODO: filter modifier key presses from OnChar
+ keyEvent.SetEventType(wxEVT_KEY_DOWN);
+
+ // Only process OnChar if OnKeyDown didn't swallow it
+ if (!dialog->GetEventHandler()->ProcessEvent (keyEvent))
+ {
+ keyEvent.SetEventType(wxEVT_CHAR);
+ dialog->GetEventHandler()->ProcessEvent(keyEvent);
+ }
}
}
}
#include "wx/filedlg.h"
#include "wx/intl.h"
#include "wx/app.h"
+#include "wx/settings.h"
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
m_pos = pos;
}
+static void wxChangeListBoxColours(wxWindow* win, Widget widget)
+{
+ win->DoChangeBackgroundColour((WXWidget) widget, *wxWHITE);
+
+ // Change colour of the scrolled areas of the listboxes
+ Widget listParent = XtParent (widget);
+ win->DoChangeBackgroundColour((WXWidget) listParent, *wxWHITE, TRUE);
+
+ Widget hsb = (Widget) 0;
+ Widget vsb = (Widget) 0;
+ XtVaGetValues (listParent,
+ XmNhorizontalScrollBar, &hsb,
+ XmNverticalScrollBar, &vsb,
+ NULL);
+
+ /* TODO: should scrollbars be affected? Should probably have separate
+ * function to change them (by default, taken from wxSystemSettings)
+ */
+ wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+ win->DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
+ win->DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
+
+ if (hsb)
+ XtVaSetValues (hsb,
+ XmNtroughColor, backgroundColour.AllocColour(XtDisplay(hsb)),
+ NULL);
+ if (vsb)
+ XtVaSetValues (vsb,
+ XmNtroughColor, backgroundColour.AllocColour(XtDisplay(vsb)),
+ NULL);
+}
+
int wxFileDialog::ShowModal()
{
wxBeginBusyCursor();
Widget fileSel = XmCreateFileSelectionDialog(parentWidget, "file_selector", NULL, 0);
XtUnmanageChild(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_HELP_BUTTON));
+
+ Widget filterWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_FILTER_TEXT);
+ Widget selectionWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_TEXT);
+ Widget dirListWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_DIR_LIST);
+ Widget fileListWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_LIST);
+ Widget okWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_OK_BUTTON);
+ Widget applyWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_APPLY_BUTTON);
+ Widget cancelWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_CANCEL_BUTTON);
+
Widget shell = XtParent(fileSel);
if (entirePath != "")
{
- Widget selectionWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_TEXT);
XmTextSetString(selectionWidget, (char*) (const char*) entirePath);
}
else
filter = m_wildCard;
- Widget filterWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_FILTER_TEXT);
XmTextSetString(filterWidget, (char*) (const char*) filter);
XmFileSelectionDoSearch(fileSel, NULL);
}
XmNresizePolicy, XmRESIZE_NONE,
NULL);
#endif
+ DoChangeBackgroundColour((WXWidget) fileSel, m_backgroundColour);
+ DoChangeBackgroundColour((WXWidget) filterWidget, *wxWHITE);
+ DoChangeBackgroundColour((WXWidget) selectionWidget, *wxWHITE);
+
+ /* For some reason this crashes
+ DoChangeBackgroundColour((WXWidget) okWidget, m_backgroundColour, TRUE);
+ DoChangeBackgroundColour((WXWidget) cancelWidget, m_backgroundColour, TRUE);
+ DoChangeBackgroundColour((WXWidget) applyWidget, m_backgroundColour, TRUE);
+ */
+
+ wxChangeListBoxColours(this, dirListWidget);
+ wxChangeListBoxColours(this, fileListWidget);
XtManageChild(fileSel);
-
+
m_fileSelectorAnswer = "";
m_fileSelectorReturned = FALSE;
XmNverticalScrollBar, &vsb,
NULL);
- /* TODO: should scrollbars be affected? Should probably have separate
- * function to change them (by default, taken from wxSystemSettings)
+ /* TODO: should scrollbars be affected? Should probably have separate
+ * function to change them (by default, taken from wxSystemSettings)
*/
wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
# problems with lex_yy.c. See also note about LEX_SCANNER
# above.
../common/lex_yy.c: ../common/lexer.l
- $(LEX) -o../common/lex.yy.c ../common/lexer.l
- sed -e "s/BUFSIZ/5000/g" < ../common/lex.yy.c | \
+ $(LEX) ../common/lexer.l
+ sed -e "s/BUFSIZ/5000/g" < lex.yy.c | \
sed -e "s/yyoutput(c)/void yyoutput(c)/g" | \
sed -e "s/YYLMAX 200/YYLMAX 5000/g" > ../common/lex_yy.c
- /bin/rm -f ../common/lex.yy.c
+ /bin/rm -f lex.yy.c
-# N.B. if you have lex instead of flex, replace the $(LEX) line above
-# with the following:
+# The above should work with both lex and flex, but just in case not,
+# here are alternative syntaxes.
+#
+# Flex-style syntax:
+# $(LEX) -olex.yy.c ../common/lexer.l
+
+# Lex-style syntax:
# $(LEX) ../common/lexer.l
# Replace yacc with bison if you run into compilation
NULL);
XtAddCallback ((Widget) button, XmNvalueChangedCallback, (XtCallbackProc) wxToolButtonCallback,
(XtPointer) this);
+
+ XtVaSetValues ((Widget) button,
+ XmNselectColor, m_backgroundColour.AllocColour(XtDisplay((Widget) button)),
+ NULL);
}
else
{
return TRUE;
}
-// Old version, assuming we use a form. Now we use
-// a bulletin board, so we can create controls on the toolbar.
-#if 0
-bool wxToolBar::CreateTools()
-{
- if (m_tools.Number() == 0)
- return FALSE;
-
- // Separator spacing
- const int separatorSize = GetToolSeparation(); // 8;
-
- int currentSpacing = 0;
-
- m_widgets.Clear();
- Widget prevButton = (Widget) 0;
- wxNode* node = m_tools.First();
- while (node)
- {
- wxToolBarTool *tool = (wxToolBarTool *)node->Data();
-
- if (tool->m_toolStyle == wxTOOL_STYLE_SEPARATOR)
- currentSpacing = separatorSize;
- else if (tool->m_bitmap1.Ok())
- {
- Widget button = (Widget) 0;
-
- if (tool->m_isToggle)
- {
- button = XtVaCreateManagedWidget("toggleButton",
- xmToggleButtonWidgetClass, (Widget) m_mainWidget,
- XmNleftAttachment, (prevButton == (Widget) 0) ? XmATTACH_FORM : XmATTACH_WIDGET,
- XmNleftWidget, (prevButton == (Widget) 0) ? NULL : prevButton,
- XmNleftOffset, currentSpacing,
- XmNtopAttachment, XmATTACH_FORM,
- // XmNpushButtonEnabled, True,
- XmNmultiClick, XmMULTICLICK_KEEP,
- XmNlabelType, XmPIXMAP,
- NULL);
- XtAddCallback ((Widget) button, XmNvalueChangedCallback, (XtCallbackProc) wxToolButtonCallback,
- (XtPointer) this);
- }
- else
- {
- button = XtVaCreateManagedWidget("button",
- xmPushButtonWidgetClass, (Widget) m_mainWidget,
- XmNleftAttachment, (prevButton == (Widget) 0) ? XmATTACH_FORM : XmATTACH_WIDGET,
- XmNleftWidget, (prevButton == (Widget) 0) ? NULL : prevButton,
- XmNleftOffset, currentSpacing,
- XmNtopAttachment, XmATTACH_FORM,
- XmNpushButtonEnabled, True,
- XmNmultiClick, XmMULTICLICK_KEEP,
- XmNlabelType, XmPIXMAP,
- NULL);
- XtAddCallback (button,
- XmNactivateCallback, (XtCallbackProc) wxToolButtonCallback,
- (XtPointer) this);
- }
-
- // For each button, if there is a mask, we must create
- // a new wxBitmap that has the correct background colour
- // for the button. Otherwise the background will just be
- // e.g. black if a transparent XPM has been loaded.
- wxBitmap originalBitmap = tool->m_bitmap1;
-
- if (tool->m_bitmap1.GetMask())
- {
- int backgroundPixel;
- XtVaGetValues(button, XmNbackground, &backgroundPixel,
- NULL);
-
-
- wxColour col;
- col.SetPixel(backgroundPixel);
-
- wxBitmap newBitmap = wxCreateMaskedBitmap(tool->m_bitmap1, col);
-
- tool->m_bitmap1 = newBitmap;
- }
-
- // Create a selected/toggled bitmap. If there isn't a m_bitmap2,
- // we need to create it (with a darker, selected background)
- int backgroundPixel;
- if (tool->m_isToggle)
- XtVaGetValues(button, XmNselectColor, &backgroundPixel,
- NULL);
- else
- XtVaGetValues(button, XmNarmColor, &backgroundPixel,
- NULL);
-
- wxColour col;
- col.SetPixel(backgroundPixel);
-
- if (tool->m_bitmap2.Ok() && tool->m_bitmap2.GetMask())
- {
- // Use what's there
- wxBitmap newBitmap = wxCreateMaskedBitmap(tool->m_bitmap2, col);
- tool->m_bitmap2 = newBitmap;
- }
- else
- {
- // Use unselected bitmap
- if (originalBitmap.GetMask())
- {
- wxBitmap newBitmap = wxCreateMaskedBitmap(originalBitmap, col);
- tool->m_bitmap2 = newBitmap;
- }
- else
- tool->m_bitmap2 = tool->m_bitmap1;
- }
-
- Pixmap pixmap = (Pixmap) tool->m_bitmap1.GetPixmap();
- Pixmap insensPixmap = (Pixmap) tool->m_bitmap1.GetInsensPixmap();
-
- if (tool->m_isToggle)
- {
- // Toggle button
- Pixmap pixmap2 = (Pixmap) 0;
- Pixmap insensPixmap2 = (Pixmap) 0;
-
- // If there's a bitmap for the toggled state, use it,
- // otherwise generate one.
- if (tool->m_bitmap2.Ok())
- {
- pixmap2 = (Pixmap) tool->m_bitmap2.GetPixmap();
- insensPixmap2 = (Pixmap) tool->m_bitmap2.GetInsensPixmap();
- }
- else
- {
- pixmap2 = (Pixmap) tool->m_bitmap1.GetArmPixmap(button);
- insensPixmap2 = XCreateInsensitivePixmap((Display*) wxGetDisplay(), pixmap2);
- m_pixmaps.Append((wxObject*) insensPixmap2); // Store for later deletion
- }
- XtVaSetValues (button,
- XmNindicatorOn, False,
- XmNshadowThickness, 2,
- // XmNborderWidth, 0,
- // XmNspacing, 0,
- XmNmarginWidth, 0,
- XmNmarginHeight, 0,
- XmNfillOnSelect, True,
- XmNlabelPixmap, pixmap,
- XmNselectPixmap, pixmap2,
- XmNlabelInsensitivePixmap, insensPixmap,
- XmNselectInsensitivePixmap, insensPixmap2,
- XmNlabelType, XmPIXMAP,
- NULL);
- }
- else
- {
- Pixmap pixmap2 = (Pixmap) 0;
-
- // If there's a bitmap for the armed state, use it,
- // otherwise generate one.
- if (tool->m_bitmap2.Ok())
- {
- pixmap2 = (Pixmap) tool->m_bitmap2.GetPixmap();
- }
- else
- {
- pixmap2 = (Pixmap) tool->m_bitmap1.GetArmPixmap(button);
-
- }
- // Normal button
- XtVaSetValues(button,
- XmNlabelPixmap, pixmap,
- XmNlabelInsensitivePixmap, insensPixmap,
- XmNarmPixmap, pixmap2,
- NULL);
- }
-
- XtAddEventHandler (button, EnterWindowMask | LeaveWindowMask,
- False, wxToolButtonPopupCallback, (XtPointer) this);
- m_widgets.Append(tool->m_index, (wxObject*) button);
-
- prevButton = button;
- currentSpacing = 0;
- }
- node = node->Next();
- }
-
- return TRUE;
-}
-#endif
-
void wxToolBar::SetToolBitmapSize(const wxSize& size)
{
// TODO not necessary?
else
tool->m_y = m_yMargin;
- wxSize& size = GetToolSize();
+ wxSize size = GetToolSize();
tool->SetSize(size.x, size.y);
m_tools.Append((long)index, tool);
return;
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
if (tool->m_isToggle)
- tool->m_toggleState = toolBar->GetToolState(index);
+ tool->m_toggleState = !tool->m_toggleState;
(void) toolBar->OnLeftClick(index, tool->m_toggleState);
}
#include "wx/settings.h"
#include "wx/msgdlg.h"
#include "wx/frame.h"
+#include "wx/scrolwin.h"
#include "wx/menuitem.h"
#include "wx/log.h"
m_clientData = NULL;
/// Motif-specific
+ m_needsRefresh = TRUE;
m_mainWidget = (WXWidget) 0;
m_button1Pressed = FALSE;
m_button2Pressed = FALSE;
m_clientData = NULL;
// Motif-specific
+ m_needsRefresh = TRUE;
m_canAddEventHandler = FALSE;
m_mainWidget = (WXWidget) 0;
m_button1Pressed = FALSE;
void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
{
+ m_needsRefresh = TRUE;
Display *display = XtDisplay((Widget) GetMainWidget());
Window thisWindow = XtWindow((Widget) GetMainWidget());
delete rect;
node = node->Next();
}
-
+
+ XmUpdateDisplay((Widget) GetMainWidget());
}
void wxWindow::OnChar(wxKeyEvent& event)
{
+ event.Skip();
/* ??
if ( event.KeyCode() == WXK_TAB ) {
// propagate the TABs to the parent - it's up to it to decide what
void wxWindow::OnKeyDown(wxKeyEvent& event)
{
- Default();
+ event.Skip();
}
void wxWindow::OnKeyUp(wxKeyEvent& event)
{
- Default();
+ event.Skip();
}
void wxWindow::OnPaint(wxPaintEvent& event)
if (event -> xexpose.count == 0)
{
+ /*
wxPaintEvent event(win->GetId());
event.SetEventObject(win);
win->GetEventHandler()->ProcessEvent(event);
+ */
+ win->DoPaint();
win->ClearUpdateRects();
}
break;
wxEventType eventType = wxEVT_CHAR;
- // TODO: Is this the correct criterion for wxEVT_KEY_DOWN down versus wxEVT_CHAR?
- if (id > WXK_START) // Non-ASCII values
- eventType = wxEVT_KEY_DOWN;
-
wxKeyEvent event (eventType);
if (local_event.xkey.state & ShiftMask)
event.SetEventType(wxEVT_CHAR_HOOK);
if (parent->GetEventHandler()->ProcessEvent(event))
return;
- event.SetEventType(wxEVT_CHAR);
}
-
- canvas->GetEventHandler()->ProcessEvent (event);
+
+ // For simplicity, OnKeyDown is the same as OnChar
+ // TODO: filter modifier key presses from OnChar
+ event.SetEventType(wxEVT_KEY_DOWN);
+
+ // Only process OnChar if OnKeyDown didn't swallow it
+ if (!canvas->GetEventHandler()->ProcessEvent (event))
+ {
+ event.SetEventType(wxEVT_CHAR);
+ canvas->GetEventHandler()->ProcessEvent (event);
+ }
}
break;
}
void wxWindow::DoPaint()
{
//TODO : make a temporary gc so we can do the XCopyArea below
- if (0) // m_backingPixmap)
+ if (m_backingPixmap && !m_needsRefresh)
{
- /*
- Widget drawingArea = (Widget) m_drawingArea;
- // int orig = GetDC()->GetLogicalFunction();
- // GetDC()->SetLogicalFunction (wxCOPY);
-
- // TODO: it may not be necessary to store m_pixmapOffsetX/Y; we
- // should be able to calculate them.
- XCopyArea (XtDisplay (drawingArea), m_backingPixmap, XtWindow (drawingArea), GetDC ()->gc,
- m_pixmapOffsetX, m_pixmapOffsetY,
- m_pixmapWidth, m_pixmapHeight,
- 0, 0);
-
- // GetDC()->SetLogicalFunction (orig);
- */
+ wxPaintDC dc(this);
+
+ GC tempGC = (GC) dc.GetBackingGC();
+
+ Widget widget = (Widget) GetMainWidget();
+
+ int scrollPosX = 0;
+ int scrollPosY = 0;
+
+ // We have to test whether it's a wxScrolledWindow (hack!)
+ // because otherwise we don't know how many pixels have been
+ // scrolled. We might solve this in the future by defining
+ // virtual wxWindow functions to get the scroll position in pixels.
+ // Or, each kind of scrolled window has to implement backing
+ // stores itself, using generic wxWindows code.
+ if (this->IsKindOf(CLASSINFO(wxScrolledWindow)))
+ {
+ wxScrolledWindow* scrolledWindow = (wxScrolledWindow*) this;
+ int x, y;
+ scrolledWindow->CalcScrolledPosition(0, 0, & x, & y);
+
+ scrollPosX = - x;
+ scrollPosY = - y;
+ }
+
+ // TODO: This could be optimized further by only copying the
+ // areas in the current update region.
+
+ // Only blit the part visible in the client area. The backing pixmap
+ // always starts at 0, 0 but we may be looking at only a portion of it.
+ wxSize clientArea = GetClientSize();
+ int toBlitX = m_pixmapWidth - scrollPosX;
+ int toBlitY = m_pixmapHeight - scrollPosY;
+
+ // Copy whichever is samller, the amount of pixmap we have to copy,
+ // or the size of the client area.
+ toBlitX = wxMin(toBlitX, clientArea.x);
+ toBlitY = wxMin(toBlitY, clientArea.y);
+
+ // Make sure we're not negative
+ toBlitX = wxMax(0, toBlitX);
+ toBlitY = wxMax(0, toBlitY);
+
+ XCopyArea (XtDisplay (widget), (Pixmap) m_backingPixmap, XtWindow (widget), tempGC,
+ scrollPosX, scrollPosY, // Start at the scroll position
+ toBlitX, toBlitY, // How much of the pixmap to copy
+ 0, 0); // Destination
}
else
{
+ // Set an erase event first
+ wxEraseEvent eraseEvent(GetId());
+ eraseEvent.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(eraseEvent);
+
wxPaintEvent event(GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
+
+ m_needsRefresh = FALSE;
}
}
}
else
{
- m_canvas->SetBackgroundColour(m_backgroundBrush.GetColour());
+ // New behaviour, 10/2/99: setting the background brush of a DC
+ // doesn't affect the window background colour. However,
+ // I'm leaving in the transparency setting because it's needed by
+ // various controls (e.g. wxStaticText) to determine whether to draw
+ // transparently or not. TODO: maybe this should be a new function
+ // wxWindow::SetTransparency(). Should that apply to the child itself, or the
+ // parent?
+// m_canvas->SetBackgroundColour(m_backgroundBrush.GetColour());
m_canvas->m_backgroundTransparent = FALSE;
}
}
// m_hDC = (WXHDC) ::GetDCEx((HWND) the_canvas->GetHWND(), NULL, DCX_WINDOW);
m_hDC = (WXHDC) ::GetWindowDC((HWND) the_canvas->GetHWND() );
m_hDCCount ++;
+
+ SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
}
wxWindowDC::~wxWindowDC(void)
m_canvas = the_canvas;
// BeginDrawing();
m_hDC = (WXHDC) ::GetDC((HWND) the_canvas->GetHWND());
+
+ SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
}
wxClientDC::~wxClientDC(void)
ms_PaintCount = 1;
m_hDCCount++;
}
+
+ SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
}
wxPaintDC::~wxPaintDC()
# problems with lex_yy.c. See also note about LEX_SCANNER
# above.
$(COMMDIR)/lex_yy.c: $(COMMDIR)/lexer.l
- $(LEX) $(COMMDIR)/lexer.l > $(COMMDIR)/lex_yy.c
+ $(LEX) $(COMMDIR)/lexer.l
+ mv lex.yy.c $(COMMDIR)/lex_yy.c
# The following may be required for FLEX
# $(LEX) -o$(COMMDIR)/lex_yy.c $(COMMDIR)/lexer.l
# problems with lex_yy.c. See also note about LEX_SCANNER
# above.
../common/lex_yy.c: ../common/lexer.l
- $(LEX) -o../common/lex.yy.c ../common/lexer.l
+ $(LEX) ../common/lexer.l
sed -e "s/BUFSIZ/5000/g" < ../common/lex.yy.c | \
sed -e "s/yyoutput(c)/void yyoutput(c)/g" | \
sed -e "s/YYLMAX 200/YYLMAX 5000/g" > ../common/lex_yy.c
config.Write("mainY", m_mainFramePos.y);
config.Write("mainWidth", m_mainFrameSize.x);
config.Write("mainHeight", m_mainFrameSize.y);
- config.Write("gridStyle", m_gridStyle);
- config.Write("gridSpacing", m_gridSpacing);
+ config.Write("gridStyle", (long) m_gridStyle);
+ config.Write("gridSpacing", (long) m_gridSpacing);
m_docManager->FileHistorySave(config);
/* XPM */
-static char *clipstudio_xpm[] = {
+static char *studio_xpm[] = {
/* columns rows colors chars-per-pixel */
"32 32 6 1",
" c Black",