Reorganization

This commit is contained in:
Simon Rozman 2016-02-03 09:20:44 +01:00
parent 7250d5bfa3
commit 43dc5c3ac4
10 changed files with 242 additions and 101 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
/*.suo /*.suo
*.user *.user
temp temp
/*.opensdf

View File

@ -11,14 +11,14 @@ Global
Release|x64 = Release|x64 Release|x64 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CD9E4170-92DD-440E-980C-D15F62032249}.Debug|Win32.ActiveCfg = Debug|x64 {CD9E4170-92DD-440E-980C-D15F62032249}.Debug|Win32.ActiveCfg = Debug|Win32
{CD9E4170-92DD-440E-980C-D15F62032249}.Debug|Win32.Build.0 = Debug|x64 {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.ActiveCfg = Debug|x64
{CD9E4170-92DD-440E-980C-D15F62032249}.Debug|x64.Build.0 = 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.ActiveCfg = Release|Win32
{CD9E4170-92DD-440E-980C-D15F62032249}.Release|Win32.Build.0 = 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.ActiveCfg = Release|x64
{CD9E4170-92DD-440E-980C-D15F62032249}.Release|x64.Build.0 = Release|Win32 {CD9E4170-92DD-440E-980C-D15F62032249}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

57
ZRCola/ZRCola.h Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <wx/wx.h>
//////////////////////////////////////////////////////////////////////////
// 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;
};

View File

@ -93,9 +93,13 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="ZRColaApp.cpp" />
<ClCompile Include="ZRColaFrame.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\include\ZRCola.h" />
<ClInclude Include="stdafx.h" /> <ClInclude Include="stdafx.h" />
<ClInclude Include="ZRCola.h" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@ -21,10 +21,22 @@
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="ZRColaFrame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ZRColaApp.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="stdafx.h"> <ClInclude Include="stdafx.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\include\ZRCola.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ZRCola.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>

43
ZRCola/ZRColaApp.cpp Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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;
}

69
ZRCola/ZRColaFrame.cpp Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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!"));
}

View File

@ -20,89 +20,10 @@
#include "stdafx.h" #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) //int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow)

View File

@ -19,21 +19,5 @@
#pragma once #pragma once
#include <Windows.h> #include "../include/ZRCola.h"
#include "ZRCola.h"
#include <wx/wx.h>
#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

50
include/ZRCola.h Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <Windows.h>
//////////////////////////////////////////////////////////////////////////
// _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