diff --git a/.gitignore b/.gitignore index ccff56b..96c3b95 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /*.suo *.user temp +/*.opensdf diff --git a/ZRCola.sln b/ZRCola.sln index 848fbf3..b04cfa0 100644 --- a/ZRCola.sln +++ b/ZRCola.sln @@ -11,14 +11,14 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CD9E4170-92DD-440E-980C-D15F62032249}.Debug|Win32.ActiveCfg = Debug|x64 - {CD9E4170-92DD-440E-980C-D15F62032249}.Debug|Win32.Build.0 = Debug|x64 + {CD9E4170-92DD-440E-980C-D15F62032249}.Debug|Win32.ActiveCfg = Debug|Win32 + {CD9E4170-92DD-440E-980C-D15F62032249}.Debug|Win32.Build.0 = Debug|Win32 {CD9E4170-92DD-440E-980C-D15F62032249}.Debug|x64.ActiveCfg = Debug|x64 {CD9E4170-92DD-440E-980C-D15F62032249}.Debug|x64.Build.0 = Debug|x64 {CD9E4170-92DD-440E-980C-D15F62032249}.Release|Win32.ActiveCfg = Release|Win32 {CD9E4170-92DD-440E-980C-D15F62032249}.Release|Win32.Build.0 = Release|Win32 - {CD9E4170-92DD-440E-980C-D15F62032249}.Release|x64.ActiveCfg = Release|Win32 - {CD9E4170-92DD-440E-980C-D15F62032249}.Release|x64.Build.0 = Release|Win32 + {CD9E4170-92DD-440E-980C-D15F62032249}.Release|x64.ActiveCfg = Release|x64 + {CD9E4170-92DD-440E-980C-D15F62032249}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ZRCola/ZRCola.h b/ZRCola/ZRCola.h new file mode 100644 index 0000000..55887bd --- /dev/null +++ b/ZRCola/ZRCola.h @@ -0,0 +1,57 @@ +/* + Copyright 2016 Amebis + + This file is part of ZRCola. + + ZRCola is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ZRCola is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ZRCola. If not, see . +*/ + +#pragma once + +#include + + +////////////////////////////////////////////////////////////////////////// +// ZRColaFrame +////////////////////////////////////////////////////////////////////////// + +class ZRColaFrame : public wxFrame +{ +public: + ZRColaFrame(const wxString& title, const wxPoint& pos, const wxSize& size); + + enum { + ID_Hello = 1 + }; + +protected: + void OnHello(wxCommandEvent& event); + void OnExit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + wxDECLARE_EVENT_TABLE(); +}; + + +////////////////////////////////////////////////////////////////////////// +// ZRColaApp +////////////////////////////////////////////////////////////////////////// + +class ZRColaApp: public wxApp +{ +public: + virtual bool OnInit(); + +protected: + wxLocale m_locale; +}; diff --git a/ZRCola/ZRCola.vcxproj b/ZRCola/ZRCola.vcxproj index c748aa7..3acf46c 100644 --- a/ZRCola/ZRCola.vcxproj +++ b/ZRCola/ZRCola.vcxproj @@ -93,9 +93,13 @@ Create Create + + + + diff --git a/ZRCola/ZRCola.vcxproj.filters b/ZRCola/ZRCola.vcxproj.filters index 6c10008..866e3c3 100644 --- a/ZRCola/ZRCola.vcxproj.filters +++ b/ZRCola/ZRCola.vcxproj.filters @@ -21,10 +21,22 @@ Source Files + + Source Files + + + Source Files + Header Files + + Header Files + + + Header Files + \ No newline at end of file diff --git a/ZRCola/ZRColaApp.cpp b/ZRCola/ZRColaApp.cpp new file mode 100644 index 0000000..d33cec2 --- /dev/null +++ b/ZRCola/ZRColaApp.cpp @@ -0,0 +1,43 @@ +/* + Copyright 2016 Amebis + + This file is part of ZRCola. + + ZRCola is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ZRCola is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ZRCola. If not, see . +*/ + +#include "stdafx.h" + + +////////////////////////////////////////////////////////////////////////// +// ZRColaApp +////////////////////////////////////////////////////////////////////////// + +wxIMPLEMENT_APP(ZRColaApp); + + +bool ZRColaApp::OnInit() +{ + if (wxLocale::IsAvailable(wxLANGUAGE_SLOVENIAN)) { + wxString sPath(wxPathOnly(argv[0])); + sPath << wxT("\\..\\locale"); + m_locale.AddCatalogLookupPathPrefix(sPath); + averify(m_locale.Init(wxLANGUAGE_SLOVENIAN)); + averify(m_locale.AddCatalog(wxT("ZRCola"))); + } + + ZRColaFrame *frame = new ZRColaFrame(_("Hello World"), wxPoint(50, 50), wxSize(450, 340)); + frame->Show(true); + return true; +} diff --git a/ZRCola/ZRColaFrame.cpp b/ZRCola/ZRColaFrame.cpp new file mode 100644 index 0000000..0f7d8d2 --- /dev/null +++ b/ZRCola/ZRColaFrame.cpp @@ -0,0 +1,69 @@ +/* + Copyright 2016 Amebis + + This file is part of ZRCola. + + ZRCola is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ZRCola is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ZRCola. If not, see . +*/ + +#include "stdafx.h" + + +////////////////////////////////////////////////////////////////////////// +// ZRColaFrame +////////////////////////////////////////////////////////////////////////// + +wxBEGIN_EVENT_TABLE(ZRColaFrame, wxFrame) + EVT_MENU(ZRColaFrame::ID_Hello, ZRColaFrame::OnHello) + EVT_MENU(wxID_EXIT, ZRColaFrame::OnExit) + EVT_MENU(wxID_ABOUT, ZRColaFrame::OnAbout) +wxEND_EVENT_TABLE() + + +ZRColaFrame::ZRColaFrame(const wxString& title, const wxPoint& pos, const wxSize& size) : wxFrame(NULL, wxID_ANY, title, pos, size) +{ + wxMenu *menuFile = new wxMenu; + menuFile->Append(ZRColaFrame::ID_Hello, _("&Hello...\tShift+H"), _("Help string shown in status bar for this menu item")); + menuFile->AppendSeparator(); + menuFile->Append(wxID_EXIT); + + wxMenu *menuHelp = new wxMenu; + menuHelp->Append(wxID_ABOUT); + + wxMenuBar *menuBar = new wxMenuBar; + menuBar->Append(menuFile, _("&File")); + menuBar->Append(menuHelp, _("&Help")); + SetMenuBar(menuBar); + + CreateStatusBar(); + SetStatusText(_("Welcome to wxWidgets!")); +} + + +void ZRColaFrame::OnExit(wxCommandEvent& event) +{ + Close(true); +} + + +void ZRColaFrame::OnAbout(wxCommandEvent& event) +{ + wxMessageBox(_("This is a wxWidgets' Hello world sample"), _("About Hello World"), wxOK | wxICON_INFORMATION); +} + + +void ZRColaFrame::OnHello(wxCommandEvent& event) +{ + wxLogMessage(_("Hello world from wxWidgets!")); +} diff --git a/ZRCola/main.cpp b/ZRCola/main.cpp index b007643..4f21845 100644 --- a/ZRCola/main.cpp +++ b/ZRCola/main.cpp @@ -20,89 +20,10 @@ #include "stdafx.h" -class MyFrame: public wxFrame -{ -public: - MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size); - - enum { - ID_Hello = 1 - }; - -private: - void OnHello(wxCommandEvent& event); - void OnExit(wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); - wxDECLARE_EVENT_TABLE(); -}; - -wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_MENU(MyFrame::ID_Hello, MyFrame::OnHello) - EVT_MENU(wxID_EXIT, MyFrame::OnExit) - EVT_MENU(wxID_ABOUT, MyFrame::OnAbout) -wxEND_EVENT_TABLE() - -MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) : wxFrame(NULL, wxID_ANY, title, pos, size) -{ - wxMenu *menuFile = new wxMenu; - menuFile->Append(MyFrame::ID_Hello, _("&Hello...\tShift+H"), _("Help string shown in status bar for this menu item")); - menuFile->AppendSeparator(); - menuFile->Append(wxID_EXIT); - - wxMenu *menuHelp = new wxMenu; - menuHelp->Append(wxID_ABOUT); - - wxMenuBar *menuBar = new wxMenuBar; - menuBar->Append(menuFile, _("&File")); - menuBar->Append(menuHelp, _("&Help")); - SetMenuBar(menuBar); - - CreateStatusBar(); - SetStatusText(_("Welcome to wxWidgets!")); -} - -void MyFrame::OnExit(wxCommandEvent& event) -{ - Close(true); -} - -void MyFrame::OnAbout(wxCommandEvent& event) -{ - wxMessageBox(_("This is a wxWidgets' Hello world sample"), _("About Hello World"), wxOK | wxICON_INFORMATION); -} - -void MyFrame::OnHello(wxCommandEvent& event) -{ - wxLogMessage(_("Hello world from wxWidgets!")); -} -class MyApp: public wxApp -{ -public: - virtual bool OnInit(); - wxLocale m_locale; -}; - -wxIMPLEMENT_APP(MyApp); - -bool MyApp::OnInit() -{ - if (wxLocale::IsAvailable(wxLANGUAGE_SLOVENIAN)) { - wxString sPath(wxPathOnly(argv[0])); - sPath << wxT("\\..\\locale"); - m_locale.AddCatalogLookupPathPrefix(sPath); - averify(m_locale.Init(wxLANGUAGE_SLOVENIAN)); - averify(m_locale.AddCatalog(wxT("ZRCola"))); - } - - MyFrame *frame = new MyFrame(_("Hello World"), wxPoint(50, 50), wxSize(450, 340)); - frame->Show(true); - return true; -} - //int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow) diff --git a/ZRCola/stdafx.h b/ZRCola/stdafx.h index a02d590..c73fb2d 100644 --- a/ZRCola/stdafx.h +++ b/ZRCola/stdafx.h @@ -19,21 +19,5 @@ #pragma once -#include - -#include - -#define __L(x) L ## x -#define _L(x) __L(x) - -#if defined(NDEBUG) // Ker je assert() definiran glede na NDEBUG, zaradi konsistentne izkušnje enako definiramo tudi aassert() in averify(). -#define aassert(expr) ((void)0) -#define averify(expr) ((void)(expr)) -#else -#if _MSC_VER < 1300 -#define aassert(expr) ((void)((expr) || (_assert ( #expr, __FILE__, __LINE__), 0))) -#else -#define aassert(expr) ((void)((expr) || (_wassert(_L(#expr), _L(__FILE__), __LINE__), 0))) -#endif -#define averify(expr) aassert(expr) -#endif +#include "../include/ZRCola.h" +#include "ZRCola.h" diff --git a/include/ZRCola.h b/include/ZRCola.h new file mode 100644 index 0000000..e5405f9 --- /dev/null +++ b/include/ZRCola.h @@ -0,0 +1,50 @@ +/* + Copyright 2016 Amebis + + This file is part of ZRCola. + + ZRCola is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ZRCola is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ZRCola. If not, see . +*/ + +#pragma once + +#include + +////////////////////////////////////////////////////////////////////////// +// _L(), __L() +////////////////////////////////////////////////////////////////////////// + +#define __L(x) L ## x +#define _L(x) __L(x) + + +////////////////////////////////////////////////////////////////////////// +// aassert(), averify() +////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif +_CRTIMP void __cdecl _wassert(_In_z_ const wchar_t * _Message, _In_z_ const wchar_t *_File, _In_ unsigned _Line); +#ifdef __cplusplus +} +#endif + +#if defined(NDEBUG) // aassert() and averify() are defined according to NDEBUG for consistent experience with assert(). +#define aassert(expr) ((void)0) +#define averify(expr) ((void)(expr)) +#else +#define aassert(expr) ((void)((expr) || (_wassert(_L(#expr), _L(__FILE__), __LINE__), 0))) +#define averify(expr) aassert(expr) +#endif