From: Vadim Zeitlin Date: Thu, 4 Feb 1999 23:21:27 +0000 (+0000) Subject: 1. more keyboard navigation fixes - seems to work now X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/341c92a8b4c813cbfb606687937dcdf5d8c3c2fe 1. more keyboard navigation fixes - seems to work now 2. wxPanel now remembers the last control which had focus, so it's restored to it when the focus returns to the panel (very handy IMHO) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1604 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/generic/panelg.h b/include/wx/generic/panelg.h index ef7ec0b3c6..d3d45a7c65 100644 --- a/include/wx/generic/panelg.h +++ b/include/wx/generic/panelg.h @@ -24,48 +24,56 @@ WXDLLEXPORT_DATA(extern const char*) wxPanelNameStr; class WXDLLEXPORT wxPanel : public wxWindow { public: - wxPanel(); + wxPanel(); + + // Old-style constructor (no default values for coordinates to avoid + // ambiguity with the new one) + wxPanel(wxWindow *parent, + int x, int y, int width, int height, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxPanelNameStr) + { + Create(parent, -1, wxPoint(x, y), wxSize(width, height), style, name); + } + + // Constructor + wxPanel(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxPanelNameStr) + { + Create(parent, id, pos, size, style, name); + } - // Old-style constructor (no default values for coordinates to avoid ambiguity - // with the new one) - wxPanel(wxWindow *parent, - int x, int y, int width, int height, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxPanelNameStr) - { - Create(parent, -1, wxPoint(x, y), wxSize(width, height), style, name); - } + // Pseudo ctor + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxPanelNameStr); + + // Sends an OnInitDialog event, which in turns transfers data to + // to the dialog via validators. + virtual void InitDialog(); - // Constructor - wxPanel(wxWindow *parent, - wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxPanelNameStr) - { - Create(parent, id, pos, size, style, name); - } + // implementation + // responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // process a keyboard navigation message (Tab traversal) + void OnNavigationKey(wxNavigationKeyEvent& event); + + // set the focus to the first child if we get it + void OnFocus(wxFocusEvent& event); - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxPanelNameStr); + // called by wxWindow whenever it gets focus + void SetLastFocus(wxWindow *focus) { m_lastFocus = focus; } - // Sends an OnInitDialog event, which in turns transfers data to - // to the dialog via validators. - virtual void InitDialog(); - - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // Process a keyboard navigation message (Tab traversal) - void OnNavigationKey(wxNavigationKeyEvent& event); - - // override base class virtuals - // we don't want focus for ourselves - virtual bool AcceptsFocus() const { return FALSE; } +protected: + // the child which had the focus last time this panel was activated + wxWindow *m_lastFocus; private: DECLARE_DYNAMIC_CLASS(wxPanel) diff --git a/include/wx/msw/control.h b/include/wx/msw/control.h index df1b339b8c..eb9b852be1 100644 --- a/include/wx/msw/control.h +++ b/include/wx/msw/control.h @@ -13,48 +13,51 @@ #define _WX_CONTROL_H_ #ifdef __GNUG__ -#pragma interface "control.h" + #pragma interface "control.h" #endif #include "wx/window.h" #include "wx/list.h" -#include "wx/validate.h" // General item class -class WXDLLEXPORT wxControl: public wxWindow +class WXDLLEXPORT wxControl : public wxWindow { - DECLARE_ABSTRACT_CLASS(wxControl) + DECLARE_ABSTRACT_CLASS(wxControl) + public: - wxControl(void); - ~wxControl(void); + wxControl(); + virtual ~wxControl(); + + // Simulates an event + virtual void Command(wxCommandEvent& WXUNUSED(event)) { } + // Calls the callback and appropriate event handlers + virtual void ProcessCommand(wxCommandEvent& event); - virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; // Simulates an event - virtual void ProcessCommand(wxCommandEvent& event); // Calls the callback and - // appropriate event handlers virtual void SetClientSize(int width, int height); virtual void SetClientSize(const wxSize& sz) { wxWindow::SetClientSize(sz); } virtual void SetLabel(const wxString& label); - virtual wxString GetLabel(void) const ; + virtual wxString GetLabel() const; #if WXWIN_COMPATIBILITY - inline virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { } - inline wxColour*GetButtonColour(void) const { return NULL; } + virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { } + wxColour* GetButtonColour() const { return NULL; } inline virtual void SetLabelFont(const wxFont& font); inline virtual void SetButtonFont(const wxFont& font); - inline wxFont& GetLabelFont(void) const ; - inline wxFont& GetButtonFont(void) const ; + inline wxFont& GetLabelFont() const; + inline wxFont& GetButtonFont() const; #endif // Places item in centre of panel - so can't be used BEFORE panel->Fit() void Centre(int direction = wxHORIZONTAL); - inline void Callback(const wxFunction function); // Adds callback + + // Adds callback + inline void Callback(const wxFunction function); // MSW-specific // Window procedure - virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual void MSWOnMouseMove(int x, int y, WXUINT flags); virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result); @@ -64,24 +67,30 @@ public: virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; }; virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; }; - inline wxFunction GetCallback(void) { return m_callback; } - inline wxList& GetSubcontrols(void) { return m_subControls; } + wxFunction GetCallback() { return m_callback; } + wxList& GetSubcontrols() { return m_subControls; } + protected: wxFunction m_callback; // Callback associated with the window // MSW implementation wxList m_subControls; // For controls like radiobuttons which are really composite -DECLARE_EVENT_TABLE() +private: + DECLARE_EVENT_TABLE() }; -inline void wxControl::Callback(const wxFunction function) { m_callback = function; }; // Adds callback +// Adds callback +inline void wxControl::Callback(const wxFunction function) +{ + m_callback = function; +}; #if WXWIN_COMPATIBILITY -inline wxFont& wxControl::GetLabelFont(void) const { return GetFont() ; } -inline wxFont& wxControl::GetButtonFont(void) const { return GetFont() ; } -inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); } -inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); } + inline wxFont& wxControl::GetLabelFont() const { return GetFont() ; } + inline wxFont& wxControl::GetButtonFont() const { return GetFont() ; } + inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); } + inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); } #endif #endif diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index a465b9e83a..0130c47615 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -433,9 +433,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) panel = new wxPanel(m_notebook); m_textentry = new MyTextCtrl( panel, -1, "Write text here.", wxPoint(10,10), wxSize(320,28), -// wxTE_PROCESS_ENTER); -0); - + 0);//wxTE_PROCESS_ENTER); (*m_textentry) << " More text."; // this text is appended m_textentry->SetInsertionPoint(0); m_textentry->WriteText("Less text."); // this text is prepended @@ -451,7 +449,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) (void)new wxButton( panel, ID_MOVE_END_ZONE, "Text &zone", wxPoint(370, 60), wxSize(110, 30) ); (void)new wxStaticBox( panel, -1, "wx&Clipboard", wxPoint(345,110), wxSize(160,100) ); (void)new wxButton( panel, ID_COPY_TEXT, "C&opy line 1", wxPoint(375,130), wxSize(110,30) ); - (void)new wxButton( panel, ID_PASTE_TEXT, "&Paste text", wxPoint(375,170), wxSize(110,30) ); + (new wxButton( panel, ID_PASTE_TEXT, "&Paste text", wxPoint(375,170), wxSize(110,30) )) + ->SetDefault(); m_notebook->AddPage( panel, "wxTextCtrl" , FALSE, Image_Text ); wxString choices2[] = @@ -542,7 +541,8 @@ void MyPanel::OnPasteFromClipboard( wxCommandEvent &WXUNUSED(event) ) wxTheClipboard->Close(); *m_text << "Closed the clipboard." << "\n"; - +#else + wxLogError("Clipboard API is not yet implemented for this platform."); #endif } @@ -892,4 +892,4 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) ) SetStatusText(msg); } -} \ No newline at end of file +} diff --git a/src/common/mimetype.cpp b/src/common/mimetype.cpp index 74fc490dfa..9f7cd6b0bf 100644 --- a/src/common/mimetype.cpp +++ b/src/common/mimetype.cpp @@ -337,8 +337,8 @@ wxString wxFileType::ExpandCommand(const wxString& command, case 's': // '%s' expands into file name (quoted because it might // contain spaces) - except if there are already quotes - // there because otherwise some programs may get confused by - // double double quotes + // there because otherwise some programs may get confused + // by double double quotes #if 0 if ( *(pc - 2) == '"' ) str << params.GetFileName(); diff --git a/src/generic/panelg.cpp b/src/generic/panelg.cpp index 966682f759..9f3813167a 100644 --- a/src/generic/panelg.cpp +++ b/src/generic/panelg.cpp @@ -34,6 +34,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow) BEGIN_EVENT_TABLE(wxPanel, wxWindow) EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged) + EVT_SET_FOCUS(wxPanel::OnFocus) EVT_NAVIGATION_KEY(wxPanel::OnNavigationKey) END_EVENT_TABLE() @@ -41,6 +42,7 @@ END_EVENT_TABLE() wxPanel::wxPanel() { + m_lastFocus = NULL; } bool wxPanel::Create(wxWindow *parent, wxWindowID id, @@ -49,6 +51,8 @@ bool wxPanel::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { + m_lastFocus = NULL; + bool ret = wxWindow::Create(parent, id, pos, size, style, name); if ( ret ) @@ -116,7 +120,10 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event ) { if (!node) { -#if 0 +//#if 0 // FIXME seems to enter in an infinite loop - how is this possible? + // we arrived at the last/first of our children - but may be this + // panel is inside another panel, so make focus go to the next/prev + // control in the parent (if we have one) if (GetParent() != NULL) { wxNavigationKeyEvent new_event; @@ -129,10 +136,12 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event ) return; } } -#endif // 0 +//#endif // 0 node = event.GetDirection() ? GetChildren().First() : GetChildren().Last(); + + continue; } wxWindow *child = (wxWindow *)node->Data(); @@ -152,3 +161,10 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event ) event.Skip(); } +void wxPanel::OnFocus(wxFocusEvent& event) +{ + if ( m_lastFocus ) + m_lastFocus->SetFocus(); + else + event.Skip(); +} diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 72c54d7704..d027e9d5e5 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -183,11 +183,6 @@ void wxControl::MSWOnMouseMove(int x, int y, WXUINT flags) Default(); } -long wxControl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) -{ - return wxWindow::MSWWindowProc(nMsg, wParam, lParam); -} - bool wxControl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM* result) { diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index dcf18535fb..f57a98eb87 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -709,11 +709,6 @@ void wxTextCtrl::ShowPosition(long pos) int linesToScroll = specifiedLineLineNo - currentLineLineNo; -/* - wxDebugMsg("Caret line: %d; Current visible line: %d; Specified line: %d; lines to scroll: %d\n", - currentLineLineNo1, currentLineLineNo, specifiedLineLineNo, linesToScroll); -*/ - if (linesToScroll != 0) (void)SendMessage(hWnd, EM_LINESCROLL, (WPARAM)0, (LPARAM)MAKELPARAM(linesToScroll, 0)); } @@ -1006,12 +1001,14 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) if ( GetEventHandler()->ProcessEvent(eventNav) ) return; } + break; } // don't just call event.Skip() because this will cause TABs and ENTERs // be passed upwards and we don't always want this - instead process it // right here - Default(); + //Default(); + event.Skip(); } long wxTextCtrl::MSWGetDlgCode() diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 20a40fd957..ddda342c66 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -21,7 +21,6 @@ #endif #ifndef WX_PRECOMP - #include #include "wx/setup.h" #include "wx/menu.h" #include "wx/dc.h" @@ -36,6 +35,8 @@ #include "wx/button.h" #include "wx/settings.h" #include "wx/msgdlg.h" + + #include #endif #if wxUSE_OWNER_DRAWN @@ -887,10 +888,8 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA wnd->m_hWnd = (WXHWND) hWnd; } - // Stop right here if we don't have a valid handle - // in our wxWnd object. + // Stop right here if we don't have a valid handle in our wxWindow object. if (wnd && !wnd->m_hWnd) { - // wxDebugMsg("Warning: could not find a valid handle, wx_win.cc/wxWndProc.\n"); wnd->m_hWnd = (WXHWND) hWnd; long res = wnd->MSWDefWindowProc(message, wParam, lParam ); wnd->m_hWnd = 0; @@ -1206,27 +1205,35 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) } case WM_KEYDOWN: - { MSWOnKeyDown((WORD) wParam, lParam); // we consider these message "not interesting" if ( wParam == VK_SHIFT || wParam == VK_CONTROL ) return Default(); - // Avoid duplicate messages to OnChar - if ( (wParam != VK_ESCAPE) && (wParam != VK_SPACE) && - (wParam != VK_RETURN) && (wParam != VK_BACK) && - (wParam != VK_TAB) ) + // Avoid duplicate messages to OnChar for these special keys + switch ( wParam ) { - MSWOnChar((WORD)wParam, lParam); - if ( ::GetKeyState(VK_CONTROL) & 0x100 ) - return Default(); + case VK_ESCAPE: + case VK_SPACE: + case VK_RETURN: + case VK_BACK: + case VK_TAB: + case VK_LEFT: + case VK_RIGHT: + case VK_DOWN: + case VK_UP: + if ( ::GetKeyState(VK_CONTROL) & 0x100 ) + MSWOnChar((WORD)wParam, lParam); + break; + + default: + MSWOnChar((WORD)wParam, lParam); + if ( ::GetKeyState(VK_CONTROL) & 0x100 ) + return Default(); + break; } - else if ( ::GetKeyState(VK_CONTROL) & 0x100 ) - MSWOnChar((WORD)wParam, lParam); - else - return Default(); + break; - } case WM_KEYUP: { @@ -1438,6 +1445,7 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) default: return MSWDefWindowProc(message, wParam, lParam ); } + return 0; // Success: we processed this command. } @@ -1704,6 +1712,13 @@ bool wxWindow::MSWOnSetFocus(WXHWND WXUNUSED(hwnd)) ::ShowCaret((HWND) GetHWND()); } + // panel wants to track the window which was the last to have focus in it + wxWindow *parent = GetParent(); + if ( parent && parent->IsKindOf(CLASSINFO(wxPanel)) ) + { + ((wxPanel *)parent)->SetLastFocus(this); + } + wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId); event.SetEventObject(this); if (!GetEventHandler()->ProcessEvent(event)) @@ -1929,22 +1944,27 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg) if ( msg->message != WM_KEYDOWN ) bProcess = FALSE; - if ( (HIWORD(msg->lParam) & KF_ALTDOWN) == KF_ALTDOWN ) + if ( bProcess && (HIWORD(msg->lParam) & KF_ALTDOWN) == KF_ALTDOWN ) bProcess = FALSE; - bool bCtrlDown = (::GetKeyState(VK_CONTROL) & 0x100) != 0; + if ( bProcess ) + { + bool bCtrlDown = (::GetKeyState(VK_CONTROL) & 0x100) != 0; - // WM_GETDLGCODE: if the control wants it for itself, don't process it - // (except for Ctrl-Tab/Enter combinations which are always processed) - LONG lDlgCode = 0; - if ( bProcess && !bCtrlDown ) { - lDlgCode = ::SendMessage(msg->hwnd, WM_GETDLGCODE, 0, 0); - } + // WM_GETDLGCODE: ask the control if it wants the key for itself, + // don't process it if it's the case (except for Ctrl-Tab/Enter + // combinations which are always processed) + LONG lDlgCode = 0; + if ( !bCtrlDown ) + { + lDlgCode = ::SendMessage(msg->hwnd, WM_GETDLGCODE, 0, 0); + } + + bool bForward = TRUE, + bWindowChange = FALSE; - bool bForward = TRUE, - bWindowChange = FALSE; - if ( bProcess ) { - switch ( msg->wParam ) { + switch ( msg->wParam ) + { case VK_TAB: if ( lDlgCode & DLGC_WANTTAB ) { bProcess = FALSE; @@ -1971,45 +1991,52 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg) break; case VK_RETURN: - // if there is a default button, Enter should press it - if ( !GetDefaultItem() ) { - // but if there is not it makes sense to make it work - // like a TAB - if ( bCtrlDown || (lDlgCode & DLGC_WANTMESSAGE == 0) ) - { - // nothing to do - all variables are already set - - break; - } - else + { + if ( lDlgCode & DLGC_WANTMESSAGE ) { // control wants to process Enter itself, don't // call IsDialogMessage() which would interpret // it return FALSE; } + + wxButton *btnDefault = GetDefaultItem(); + if ( btnDefault && !bCtrlDown ) + { + // if there is a default button, Enter should + // press it + (void)::SendMessage((HWND)btnDefault->GetHWND(), + BM_CLICK, 0, 0); + return TRUE; + } + // else: but if there is not it makes sense to make it + // work like a TAB - and that's what we do. + // Note that Ctrl-Enter always works this way. } - //else: fall through and don't process the message + break; default: bProcess = FALSE; } - } - if ( bProcess ) { - wxNavigationKeyEvent event; - event.SetDirection(bForward); - event.SetWindowChange(bWindowChange); - event.SetEventObject(this); + if ( bProcess ) + { + wxNavigationKeyEvent event; + event.SetDirection(bForward); + event.SetWindowChange(bWindowChange); + event.SetEventObject(this); - if ( GetEventHandler()->ProcessEvent(event) ) - return TRUE; + if ( GetEventHandler()->ProcessEvent(event) ) + return TRUE; + } } - return ::IsDialogMessage((HWND)GetHWND(), msg) != 0; + if ( ::IsDialogMessage((HWND)GetHWND(), msg) ) + return TRUE; } #if wxUSE_TOOLTIPS - else if ( m_tooltip ) { + if ( m_tooltip ) + { // relay mouse move events to the tooltip control MSG *msg = (MSG *)pMsg; if ( msg->message == WM_MOUSEMOVE ) @@ -2232,7 +2259,6 @@ void wxWindow::MSWOnMButtonDown(int x, int y, WXUINT flags) void wxWindow::MSWOnMButtonUp(int x, int y, WXUINT flags) { - //wxDebugMsg("MButtonUp\n") ; wxMouseEvent event(wxEVT_MIDDLE_UP); event.m_x = x; event.m_y = y; @@ -3616,18 +3642,6 @@ WXDWORD wxWindow::Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D) void wxWindow::OnChar(wxKeyEvent& event) { -#if 0 - if ( event.KeyCode() == WXK_TAB ) { - // propagate the TABs to the parent - it's up to it to decide what - // to do with it - wxWindow *parent = GetParent(); - if ( parent ) { - if ( parent->GetEventHandler()->ProcessEvent(event) ) - return; - } - } -#endif // 0 - bool isVirtual; int id = wxCharCodeWXToMSW((int)event.KeyCode(), &isVirtual); @@ -3661,7 +3675,7 @@ bool wxWindow::TransferDataToWindow() if ( child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->TransferToWindow() ) { - wxMessageBox("Application Error", "Could not transfer data to window", wxOK|wxICON_EXCLAMATION); + wxLogError(_("Could not transfer data to window")); return FALSE; } @@ -4043,16 +4057,17 @@ void wxWindow::SetConstraintSizes(bool recurse) winName = "unnamed"; else winName = GetName(); - wxDebugMsg("Constraint(s) not satisfied for window of type %s, name %s:\n", (const char *)windowClass, (const char *)winName); + wxLogDebug("Constraint(s) not satisfied for window of type %s, name %s:", + (const char *)windowClass, (const char *)winName); if (!constr->left.GetDone()) - wxDebugMsg(" unsatisfied 'left' constraint.\n"); + wxLogDebug(" unsatisfied 'left' constraint."); if (!constr->right.GetDone()) - wxDebugMsg(" unsatisfied 'right' constraint.\n"); + wxLogDebug(" unsatisfied 'right' constraint."); if (!constr->width.GetDone()) - wxDebugMsg(" unsatisfied 'width' constraint.\n"); + wxLogDebug(" unsatisfied 'width' constraint."); if (!constr->height.GetDone()) - wxDebugMsg(" unsatisfied 'height' constraint.\n"); - wxDebugMsg("Please check constraints: try adding AsIs() constraints.\n"); + wxLogDebug(" unsatisfied 'height' constraint."); + wxLogDebug("Please check constraints: try adding AsIs() constraints.\n"); } if (recurse) diff --git a/src/png/makefile.nt b/src/png/makefile.nt new file mode 100644 index 0000000000..ab823c8fc9 --- /dev/null +++ b/src/png/makefile.nt @@ -0,0 +1,68 @@ +# +# File: makefile.nt +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds winpng.lib library for Windows 3.1 + +# Change WXDIR or WXWIN to wherever wxWindows is found +WXDIR = $(WXWIN) +WXLIB = $(WXDIR)\lib\wx.lib +WXINC = $(WXDIR)\include + +WINPNGDIR = ..\png +WINPNGINC = $(WINPNGDIR) +WINPNGLIB = ..\..\lib\winpng.lib + +INC = /I..\zlib + +FINAL=1 + +# Set this to nothing if your compiler is MS C++ 7 +ZOPTION= + +!ifndef FINAL +FINAL=0 +!endif + +PRECOMP=/YuWX.H + +!if "$(FINAL)" == "0" +OPT = /Od +CPPFLAGS= /W4 /Zi /MD /GX- $(ZOPTION) $(OPT) /Dwx_msw $(INC) # $(PRECOMP) /Fp$(WXDIR)\src\msw\wx.pch +CFLAGS= /W4 /Zi /MD /GX- /Od /Dwx_msw $(INC) +LINKFLAGS=/NOD /CO /ONERROR:NOEXE +!else +# /Ox for real FINAL version +OPT = /O2 +CPPFLAGS= /W4 /MD /GX- /Dwx_msw $(INC) # $(PRECOMP) /Fp$(WXDIR)\src\msw\wx.pch +CFLAGS= /W4 /MD /GX- /Dwx_msw $(INC) +LINKFLAGS=/NOD /ONERROR:NOEXE +!endif + +OBJECTS = png.obj pngread.obj pngrtran.obj pngrutil.obj \ + pngpread.obj pngtrans.obj pngwrite.obj pngwtran.obj pngwutil.obj \ + pngerror.obj pngmem.obj pngwio.obj pngrio.obj pngget.obj pngset.obj + +all: $(WINPNGLIB) + +$(WINPNGLIB): $(OBJECTS) + erase $(WINPNGLIB) + lib @<< +-out:$(WINPNGLIB) +$(OBJECTS) +<< + +.c.obj: + cl -DWIN32 $(OPT) $(CFLAGS) /c $*.c + +clean: + erase *.obj + erase *.exe + erase *.lib + +cleanall: clean