A lot of changes with CrossBench. Created CUI, one fix in crossgen.hpp
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#include <wx/wx.h>
|
||||
#include "wx/wx.h"
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/cmdline.h>
|
||||
|
||||
#include "crossbasetypes.hpp"
|
||||
#include "crossgen.hpp"
|
||||
|
||||
/* To-Do:
|
||||
* Console app that runs generating of crosswords
|
||||
@@ -11,35 +15,42 @@
|
||||
* 3. Dispersion
|
||||
*/
|
||||
|
||||
// application class
|
||||
class wxMiniApp : public wxApp
|
||||
{
|
||||
public:
|
||||
// function called at the application initialization
|
||||
virtual bool OnInit();
|
||||
|
||||
// event handler for button click
|
||||
void OnClick(wxCommandEvent& event) {
|
||||
GetTopWindow()->Close();
|
||||
}
|
||||
static const wxCmdLineEntryDesc cmdLineDesc[] = {
|
||||
{ wxCMD_LINE_PARAM , wxT(""), wxT(""), wxT("cross_path"),
|
||||
wxCMD_LINE_VAL_STRING },
|
||||
{ wxCMD_LINE_PARAM, wxT(""), wxT(""), wxT("dict_path"),
|
||||
wxCMD_LINE_VAL_STRING },
|
||||
{ wxCMD_LINE_OPTION, wxT("c"), wxT("count"), wxT("times to run generation, default = 10") ,
|
||||
wxCMD_LINE_VAL_NUMBER },
|
||||
{ wxCMD_LINE_SWITCH, wxT("h"), wxT("help"), wxT("show this help message"),
|
||||
wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
|
||||
{ wxCMD_LINE_NONE }
|
||||
};
|
||||
|
||||
IMPLEMENT_APP(wxMiniApp);
|
||||
int main(int argc, char **argv) {
|
||||
wxInitializer wx_initializer;
|
||||
if ( !wx_initializer ) {
|
||||
fprintf(stderr, "Failed to initialize the wxWidgets library, aborting.");
|
||||
return -1;
|
||||
}
|
||||
wxCmdLineParser cmd_parser(cmdLineDesc, argc, argv);
|
||||
long run_count = 10;
|
||||
wxString cross_path, dict_path;
|
||||
switch ( cmd_parser.Parse() ) {
|
||||
case -1:
|
||||
return 0;
|
||||
case 0:
|
||||
cmd_parser.Found(wxT("count"), &run_count);
|
||||
cross_path = cmd_parser.GetParam(0);
|
||||
dict_path = cmd_parser.GetParam(1);
|
||||
wxPrintf(wxT("cross_path = ") + cross_path + wxT("\n"));
|
||||
wxPrintf(wxT("dict_path = ") + dict_path + wxT("\n"));
|
||||
wxPrintf(wxT("run_count = %d\n"), run_count);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool wxMiniApp::OnInit()
|
||||
{
|
||||
// create a new frame and set it as the top most application window
|
||||
SetTopWindow( new wxFrame( NULL, -1, wxT(""), wxDefaultPosition, wxSize( 100, 50) ) );
|
||||
|
||||
// create new button and assign it to the main frame
|
||||
new wxButton( GetTopWindow(), wxID_EXIT, wxT("Click!") );
|
||||
|
||||
// connect button click event with event handler
|
||||
Connect(wxID_EXIT, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxMiniApp::OnClick) );
|
||||
|
||||
// show main frame
|
||||
GetTopWindow()->Show();
|
||||
|
||||
// enter the application's main loop
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CodeLite_Workspace Name="CrossGen" Database="">
|
||||
<Project Name="wxCrossGen" Path="wxCrossGen/wxCrossGen.project" Active="Yes"/>
|
||||
<Project Name="CrossBench" Path="CrossBench/CrossBench.project" Active="No"/>
|
||||
<Project Name="wxCrossGen" Path="wxCrossGen/wxCrossGen.project" Active="No"/>
|
||||
<Project Name="CrossBench" Path="CrossBench/CrossBench.project" Active="Yes"/>
|
||||
<BuildMatrix>
|
||||
<WorkspaceConfiguration Name="Debug" Selected="no">
|
||||
<WorkspaceConfiguration Name="Debug" Selected="yes">
|
||||
<Project Name="wxCrossGen" ConfigName="Debug"/>
|
||||
<Project Name="CrossBench" ConfigName="Debug"/>
|
||||
</WorkspaceConfiguration>
|
||||
<WorkspaceConfiguration Name="Release" Selected="yes">
|
||||
<WorkspaceConfiguration Name="Release" Selected="no">
|
||||
<Project Name="wxCrossGen" ConfigName="Release"/>
|
||||
<Project Name="CrossBench" ConfigName="Release"/>
|
||||
</WorkspaceConfiguration>
|
||||
|
||||
8
Makefile
8
Makefile
@@ -1,8 +1,8 @@
|
||||
.PHONY: clean All
|
||||
|
||||
All:
|
||||
@echo "----------Building project:[ wxCrossGen - Release ]----------"
|
||||
@cd "wxCrossGen" && $(MAKE) -f "wxCrossGen.mk"
|
||||
@echo "----------Building project:[ CrossBench - Debug ]----------"
|
||||
@cd "CrossBench" && $(MAKE) -f "CrossBench.mk"
|
||||
clean:
|
||||
@echo "----------Cleaning project:[ wxCrossGen - Release ]----------"
|
||||
@cd "wxCrossGen" && $(MAKE) -f "wxCrossGen.mk" clean
|
||||
@echo "----------Cleaning project:[ CrossBench - Debug ]----------"
|
||||
@cd "CrossBench" && $(MAKE) -f "CrossBench.mk" clean
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/textfile.h>
|
||||
|
||||
#include "crossbasetypes.hpp"
|
||||
|
||||
@@ -175,7 +178,7 @@ bool procCross(UsedWords used, AllWordsType &words, CurGridType grid,
|
||||
|
||||
void generateCross(GridType &grid, const DictType &dict, std::vector<wxString> &words_out){
|
||||
AllWordsType words;
|
||||
for (DictType::iterator it = dict.begin(); it != dict.end(); ++it){
|
||||
for (auto it = dict.begin(); it != dict.end(); ++it){
|
||||
if (words.size() <= it->first.size())
|
||||
words.resize(it->first.size() + 2);
|
||||
words.at(it->first.size()).push_back(it->first);
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
## Auto Generated makefile by CodeLite IDE
|
||||
## any manual changes will be erased
|
||||
##
|
||||
## Release
|
||||
## Debug
|
||||
ProjectName :=wxCrossGen
|
||||
ConfigurationName :=Release
|
||||
ConfigurationName :=Debug
|
||||
WorkspacePath := "/data/Sync/SyncProjects/CrossGen"
|
||||
ProjectPath := "/data/Sync/SyncProjects/CrossGen/wxCrossGen"
|
||||
IntermediateDirectory :=../Release
|
||||
IntermediateDirectory :=./Debug
|
||||
OutDir := $(IntermediateDirectory)
|
||||
CurrentFileName :=
|
||||
CurrentFilePath :=
|
||||
CurrentFileFullPath :=
|
||||
User :=Aleksey Lobanov
|
||||
Date :=11/06/15
|
||||
Date :=12/06/15
|
||||
CodeLitePath :="/home/alex/.codelite"
|
||||
LinkerName :=/usr/bin/g++-4.8
|
||||
SharedObjectLinkerName :=/usr/bin/g++-4.8 -shared -fPIC
|
||||
@@ -28,14 +28,14 @@ LibraryPathSwitch :=-L
|
||||
PreprocessorSwitch :=-D
|
||||
SourceSwitch :=-c
|
||||
OutputFile :=$(IntermediateDirectory)/$(ProjectName).out
|
||||
Preprocessors :=$(PreprocessorSwitch)NDEBUG
|
||||
Preprocessors :=
|
||||
ObjectSwitch :=-o
|
||||
ArchiveOutputSwitch :=
|
||||
PreprocessOnlySwitch :=-E
|
||||
ObjectsFileList :="wxCrossGen.txt"
|
||||
PCHCompileFlags :=
|
||||
MakeDirCommand :=mkdir -p
|
||||
LinkOptions := -s $(shell wx-config --debug=no --libs --unicode=yes)
|
||||
LinkOptions := $(shell wx-config --debug=yes --libs --unicode=yes)
|
||||
IncludePath := $(IncludeSwitch). $(IncludeSwitch)../src
|
||||
IncludePCH :=
|
||||
RcIncludePath :=
|
||||
@@ -50,8 +50,8 @@ LibPath := $(LibraryPathSwitch).
|
||||
AR := /usr/bin/ar rcu
|
||||
CXX := /usr/bin/g++-4.8
|
||||
CC := /usr/bin/gcc-4.8
|
||||
CXXFLAGS := -std=c++11 -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors)
|
||||
CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors)
|
||||
CXXFLAGS := -std=c++11 -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) $(Preprocessors)
|
||||
CFLAGS := -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) $(Preprocessors)
|
||||
ASFLAGS :=
|
||||
AS := /usr/bin/as
|
||||
|
||||
@@ -79,7 +79,7 @@ $(OutputFile): $(IntermediateDirectory)/.d $(Objects)
|
||||
$(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions)
|
||||
|
||||
$(IntermediateDirectory)/.d:
|
||||
@test -d ../Release || $(MakeDirCommand) ../Release
|
||||
@test -d ./Debug || $(MakeDirCommand) ./Debug
|
||||
|
||||
PreBuild:
|
||||
|
||||
@@ -101,6 +101,6 @@ $(IntermediateDirectory)/main.cpp$(PreprocessSuffix): main.cpp
|
||||
## Clean
|
||||
##
|
||||
clean:
|
||||
$(RM) -r ../Release/
|
||||
$(RM) -r ./Debug/
|
||||
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
../Release/main.cpp.o
|
||||
./Debug/main.cpp.o
|
||||
|
||||
Reference in New Issue
Block a user