Big changes of project structure
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CodeLite_Project Name="CrossBench" InternalType="GUI">
|
<CodeLite_Project Name="CrossBench" InternalType="GUI">
|
||||||
|
<Plugins>
|
||||||
|
<Plugin Name="CppCheck"/>
|
||||||
|
</Plugins>
|
||||||
<Description/>
|
<Description/>
|
||||||
<Dependencies/>
|
<Dependencies/>
|
||||||
<VirtualDirectory Name="src">
|
<VirtualDirectory Name="src">
|
||||||
|
|||||||
78
src/crossexport.cpp
Normal file
78
src/crossexport.cpp
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
#include "crossexport.hpp"
|
||||||
|
|
||||||
|
void fillCross(FilledCrossword &cross){
|
||||||
|
for ( size_t i = 0; i < cross.words.size(); ++i ) {
|
||||||
|
if ( cross.words.at(i).direct == true ) {
|
||||||
|
for (size_t j = 0; j < cross.words.at(i).len; ++j){
|
||||||
|
cross.grid.at(cross.words.at(i).x+j).at(cross.words.at(i).y) = cross.ans.at(i).at(j);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (size_t j = 0; j < cross.words.at(i).len; ++j)
|
||||||
|
cross.grid.at(cross.words.at(i).x).at(cross.words.at(i).y+j) = cross.ans.at(i).at(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString getGridString(const FilledCrossword &cross, wxChar space = wxT('-')){
|
||||||
|
const wxString LINE_END = wxTextFile::GetEOL();
|
||||||
|
|
||||||
|
wxString t_string;
|
||||||
|
|
||||||
|
FilledCrossword t_cross(cross);
|
||||||
|
if ( !t_cross.ans.empty() ) {
|
||||||
|
fillCross(t_cross);
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < t_cross.grid.at(0).size(); ++i){
|
||||||
|
for (size_t j = 0; j < t_cross.grid.size(); ++j){
|
||||||
|
if ( t_cross.grid.at(j).at(i) == CELL_BORDER )
|
||||||
|
t_string += space;
|
||||||
|
else
|
||||||
|
t_string += t_cross.grid.at(j).at(i);
|
||||||
|
}
|
||||||
|
t_string += LINE_END;
|
||||||
|
}
|
||||||
|
return t_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString getQuesString(const FilledCrossword &cross){
|
||||||
|
const wxString LINE_END = wxTextFile::GetEOL();
|
||||||
|
|
||||||
|
wxString t_string;
|
||||||
|
|
||||||
|
if ( !cross.ques.empty() ) { // == print questions
|
||||||
|
t_string += _("Vertical words:") + LINE_END;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < cross.words.size(); ++i){
|
||||||
|
if (cross.words.at(i).direct == false)
|
||||||
|
t_string += wxString::Format(wxT("%d. "), cross.words.at(i).ind)
|
||||||
|
+ cross.ques.at(i) + LINE_END;
|
||||||
|
}
|
||||||
|
|
||||||
|
t_string += _("Horisontal words:") + LINE_END;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < cross.words.size(); ++i){
|
||||||
|
if (cross.words.at(i).direct == true)
|
||||||
|
t_string += wxString::Format(wxT("%d. "), cross.words.at(i).ind)
|
||||||
|
+ cross.ques.at(i) + LINE_END;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return t_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
void exportToString(const FilledCrossword &cross, wxString &str_out, wxChar space = wxT('-')){
|
||||||
|
str_out += getGridString(cross, space) + getQuesString(cross);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool exportToFile(const FilledCrossword &cross, const wxString path){
|
||||||
|
wxTextFile f(path);
|
||||||
|
if ( f.Exists() )
|
||||||
|
return false;
|
||||||
|
f.Create();
|
||||||
|
f.Open(path);
|
||||||
|
wxString cont;
|
||||||
|
exportToString(cross, cont);
|
||||||
|
f.AddLine(cont);
|
||||||
|
f.Write();
|
||||||
|
f.Close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -2,84 +2,19 @@
|
|||||||
#define CROSSEXPORT_HPP
|
#define CROSSEXPORT_HPP
|
||||||
|
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
|
#include <wx/textfile.h>
|
||||||
|
|
||||||
|
#include "crossgen.hpp"
|
||||||
#include "crossbasetypes.hpp"
|
#include "crossbasetypes.hpp"
|
||||||
|
|
||||||
void fillCross(FilledCrossword &cross){
|
void fillCross(FilledCrossword &cross);
|
||||||
for ( size_t i = 0; i < cross.words.size(); ++i ) {
|
|
||||||
if ( cross.words.at(i).direct == true ) {
|
|
||||||
for (size_t j = 0; j < cross.words.at(i).len; ++j){
|
|
||||||
cross.grid.at(cross.words.at(i).x+j).at(cross.words.at(i).y) = cross.ans.at(i).at(j);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (size_t j = 0; j < cross.words.at(i).len; ++j)
|
|
||||||
cross.grid.at(cross.words.at(i).x).at(cross.words.at(i).y+j) = cross.ans.at(i).at(j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString getGridString(const FilledCrossword &cross, wxChar space = wxT('-')){
|
wxString getGridString(const FilledCrossword &cross, wxChar space);
|
||||||
const wxString LINE_END = wxTextFile::GetEOL();
|
|
||||||
|
|
||||||
wxString t_string;
|
|
||||||
|
|
||||||
FilledCrossword t_cross(cross);
|
|
||||||
if ( !t_cross.ans.empty() ) {
|
|
||||||
fillCross(t_cross);
|
|
||||||
}
|
|
||||||
for (size_t i = 0; i < t_cross.grid.at(0).size(); ++i){
|
|
||||||
for (size_t j = 0; j < t_cross.grid.size(); ++j){
|
|
||||||
if ( t_cross.grid.at(j).at(i) == CELL_BORDER )
|
|
||||||
t_string += space;
|
|
||||||
else
|
|
||||||
t_string += t_cross.grid.at(j).at(i);
|
|
||||||
}
|
|
||||||
t_string += LINE_END;
|
|
||||||
}
|
|
||||||
return t_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString getQuesString(const FilledCrossword &cross){
|
wxString getQuesString(const FilledCrossword &cross);
|
||||||
const wxString LINE_END = wxTextFile::GetEOL();
|
|
||||||
|
|
||||||
wxString t_string;
|
|
||||||
|
|
||||||
if ( !cross.ques.empty() ) { // == print questions
|
|
||||||
t_string += _("Vertical words:") + LINE_END;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < cross.words.size(); ++i){
|
|
||||||
if (cross.words.at(i).direct == false)
|
|
||||||
t_string += wxString::Format(wxT("%d. "), cross.words.at(i).ind)
|
|
||||||
+ cross.ques.at(i) + LINE_END;
|
|
||||||
}
|
|
||||||
|
|
||||||
t_string += _("Horisontal words:") + LINE_END;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < cross.words.size(); ++i){
|
|
||||||
if (cross.words.at(i).direct == true)
|
|
||||||
t_string += wxString::Format(wxT("%d. "), cross.words.at(i).ind)
|
|
||||||
+ cross.ques.at(i) + LINE_END;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return t_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
void exportToString(const FilledCrossword &cross, wxString &str_out, wxChar space = wxT('-')){
|
void exportToString(const FilledCrossword &cross, wxString &str_out, wxChar space);
|
||||||
str_out += getGridString(cross, space) + getQuesString(cross);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool exportToFile(const FilledCrossword &cross, const wxString path){
|
bool exportToFile(const FilledCrossword &cross, const wxString path);
|
||||||
wxTextFile f(path);
|
|
||||||
if ( f.Exists() )
|
|
||||||
return false;
|
|
||||||
f.Create();
|
|
||||||
f.Open(path);
|
|
||||||
wxString cont;
|
|
||||||
exportToString(cross, cont);
|
|
||||||
f.AddLine(cont);
|
|
||||||
f.Write();
|
|
||||||
f.Close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // CROSSEXPORT_HPP
|
#endif // CROSSEXPORT_HPP
|
||||||
|
|||||||
252
src/crossgen.cpp
Normal file
252
src/crossgen.cpp
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
#include "crossgen.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
const wxChar CELL_CLEAR = wxT('+');
|
||||||
|
const wxChar CELL_BORDER = wxT('-');
|
||||||
|
const TransedChar TRANS_CLEAR = 0;
|
||||||
|
const TransedChar TRANS_BORDER = 1;
|
||||||
|
const uint32_t MAX_WORD_COUNT = 262144; // =2^18
|
||||||
|
|
||||||
|
void readDict(const wxString path, DictType &dict_out){
|
||||||
|
wxTextFile f;
|
||||||
|
f.Open(path);
|
||||||
|
for ( wxString str = f.GetFirstLine(); !f.Eof(); str = f.GetNextLine() ) {
|
||||||
|
wxString key,val;
|
||||||
|
int del_ind = str.Index('-');
|
||||||
|
key = str.Left(del_ind-1);
|
||||||
|
val = str.Right(str.size() - del_ind - 2);
|
||||||
|
dict_out[key] = val;
|
||||||
|
}
|
||||||
|
f.Close();
|
||||||
|
};
|
||||||
|
|
||||||
|
void readGrid(const wxString path, GridType &grid){
|
||||||
|
wxTextFile f;
|
||||||
|
f.Open(path);
|
||||||
|
wxString str = f.GetFirstLine();
|
||||||
|
|
||||||
|
grid.resize(str.size());
|
||||||
|
for (unsigned int i = 0; i < grid.size(); ++i)
|
||||||
|
grid.at(i).resize(f.GetLineCount());
|
||||||
|
|
||||||
|
wxLogDebug(wxT("Total lines: %d. First line is %s and size = %d"),f.GetLineCount(), str.c_str(),str.size());
|
||||||
|
unsigned int i = 0;
|
||||||
|
for ( ; !f.Eof(); str = f.GetNextLine() ) {
|
||||||
|
wxLogDebug(str);
|
||||||
|
for (unsigned int j = 0; j < str.size(); ++j)
|
||||||
|
grid.at(j).at(i) = str.at(j);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
wxLogDebug(wxT("Прочитана сетка размером %d x %d"),
|
||||||
|
static_cast<int>(grid.size()), static_cast<int>(grid.at(0).size()));
|
||||||
|
f.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString getFromTransed(const TransedWord &tw, const BackedCharsTransType &bchar_trans){
|
||||||
|
wxString s;
|
||||||
|
s.resize(tw.size());
|
||||||
|
for (size_t i = 0; i < tw.size(); ++i){
|
||||||
|
s[i] = bchar_trans.at(tw.at(i));
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
BackedCharsTransType getFromCharsTransed(const CharsTransType &char_trans){
|
||||||
|
BackedCharsTransType t;
|
||||||
|
for (auto it = char_trans.begin(); it != char_trans.end(); ++it)
|
||||||
|
t[it->second] = it->first;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
void toWorkGridType(const GridType &grid, WorkGridType &grid_out){
|
||||||
|
grid_out.clear();
|
||||||
|
grid_out.resize(grid.size());
|
||||||
|
for (size_t i = 0; i < grid.size(); ++i){
|
||||||
|
grid_out.at(i).resize(grid.at(0).size());
|
||||||
|
for (size_t j = 0; j < grid.at(0).size(); ++j){
|
||||||
|
if ( grid.at(i).at(j) == CELL_CLEAR )
|
||||||
|
grid_out.at(i).at(j) = TRANS_CLEAR;
|
||||||
|
else
|
||||||
|
grid_out.at(i).at(j) = TRANS_BORDER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void generateAllWords(const DictType &dict, AllWordsType &words_out,
|
||||||
|
CharsTransType &char_trans_out){
|
||||||
|
words_out.clear();
|
||||||
|
char_trans_out.clear();
|
||||||
|
char_trans_out[CELL_CLEAR] = TRANS_CLEAR;
|
||||||
|
char_trans_out[CELL_BORDER] = TRANS_BORDER;
|
||||||
|
static_assert(TRANS_CLEAR + 1 == TRANS_BORDER, "TRANS_CLEAR + 1 != TRANS_BORDER");
|
||||||
|
TransedChar st = TRANS_BORDER + 1;
|
||||||
|
for (auto it = dict.begin(); it != dict.end(); ++it){
|
||||||
|
if ( words_out.size() <= it->first.size() )
|
||||||
|
words_out.resize(it->first.size() + 2);
|
||||||
|
TransedWord t_tw(it->first.size());
|
||||||
|
for (size_t i = 0; i < it->first.size(); ++i){
|
||||||
|
auto cur_ch = it->first.at(i);
|
||||||
|
if ( char_trans_out.find(cur_ch) == char_trans_out.end() ){
|
||||||
|
char_trans_out[cur_ch] = st;
|
||||||
|
++st;
|
||||||
|
}
|
||||||
|
t_tw.at(i) = char_trans_out[cur_ch];
|
||||||
|
}
|
||||||
|
words_out.at(it->first.size()).push_back(t_tw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void generateWordInfo(const GridType &grid, std::vector<WordInfo> &winfos_out){
|
||||||
|
wxLogDebug(wxT("Printing grid: "));
|
||||||
|
for (size_t i = 0; i < grid.size(); ++i){
|
||||||
|
wxString st;
|
||||||
|
for (size_t j = 0; j < grid.at(0).size(); ++j)
|
||||||
|
st += grid.at(i).at(j);
|
||||||
|
wxLogDebug(st);
|
||||||
|
}
|
||||||
|
size_t cur_ind = 1;
|
||||||
|
bool exist = false;
|
||||||
|
auto y_len = grid.at(0).size();
|
||||||
|
auto x_len = grid.size();
|
||||||
|
for (size_t j = 0; j < y_len; ++j){
|
||||||
|
for (size_t i = 0; i < x_len; ++i){
|
||||||
|
if ( grid.at(i).at(j) == CELL_CLEAR ) {
|
||||||
|
if ( ((j == 0) || (grid.at(i).at(j - 1) != CELL_CLEAR)) &&
|
||||||
|
(j !=y_len - 1) )
|
||||||
|
if ( grid.at(i).at(j+1) == CELL_CLEAR ) {
|
||||||
|
size_t cur_len = 1;
|
||||||
|
bool cont = true;
|
||||||
|
while ( (j + cur_len < y_len) && cont ) {
|
||||||
|
++cur_len;
|
||||||
|
if ( grid.at(i).at(j+cur_len-1) != CELL_CLEAR ) {
|
||||||
|
cont = false;
|
||||||
|
--cur_len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exist = true;
|
||||||
|
|
||||||
|
WordInfo t;
|
||||||
|
t.x = i;
|
||||||
|
t.y = j;
|
||||||
|
t.len = cur_len;
|
||||||
|
t.ind = cur_ind;
|
||||||
|
t.direct = false;
|
||||||
|
winfos_out.push_back(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ((i ==0) || (grid.at(i - 1).at(j) != CELL_CLEAR)) &&
|
||||||
|
(i != x_len - 1) )
|
||||||
|
if ( grid.at(i + 1).at(j) == CELL_CLEAR ){
|
||||||
|
size_t cur_len = 1;
|
||||||
|
bool cont = true;
|
||||||
|
while ((i + cur_len < x_len) && cont){
|
||||||
|
++cur_len;
|
||||||
|
if (grid.at(i+cur_len-1).at(j) != CELL_CLEAR){
|
||||||
|
cont = false;
|
||||||
|
--cur_len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exist = true;
|
||||||
|
WordInfo t;
|
||||||
|
t.x = i;
|
||||||
|
t.y = j;
|
||||||
|
t.len = cur_len;
|
||||||
|
t.ind = cur_ind;
|
||||||
|
t.direct = true;
|
||||||
|
winfos_out.push_back(t);
|
||||||
|
}
|
||||||
|
if ( exist ){
|
||||||
|
exist = false;
|
||||||
|
++cur_ind;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
template <class T>
|
||||||
|
uint32_t getWordUniq(const T &w_ind, const T &w_len){
|
||||||
|
return w_ind + w_len * MAX_WORD_COUNT;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
bool procCross(
|
||||||
|
UsedWords used,
|
||||||
|
const AllWordsType &words,
|
||||||
|
WorkGridType grid,
|
||||||
|
const std::vector<WordInfo> &winfos,
|
||||||
|
const size_t cur_word_ind,
|
||||||
|
std::vector<TransedWord> &out
|
||||||
|
){
|
||||||
|
if (cur_word_ind == winfos.size())
|
||||||
|
return true;
|
||||||
|
WordInfo cur_wi = winfos.at(cur_word_ind);
|
||||||
|
size_t rand_add = rand() % 100000;
|
||||||
|
size_t cur_len = cur_wi.len;
|
||||||
|
size_t cur_words_size = words.at(cur_len).size();
|
||||||
|
for (size_t icw = 0; icw < cur_words_size; ++icw){
|
||||||
|
if (used.find(getWordUniq(icw,cur_len)) != used.end())
|
||||||
|
continue;
|
||||||
|
TransedWord cur_word = words.at(cur_len).at((icw + rand_add) % cur_words_size);
|
||||||
|
// Показывает, можно ли записать это слово в сетку
|
||||||
|
bool can_write = true;
|
||||||
|
if ( cur_wi.direct == false ){
|
||||||
|
for (size_t j = 0; j < cur_wi.len; ++j)
|
||||||
|
if ((grid.at(cur_wi.x).at(j + cur_wi.y) != TRANS_CLEAR) &&
|
||||||
|
(grid.at(cur_wi.x).at(j + cur_wi.y) != cur_word.at(j)))
|
||||||
|
can_write = false;
|
||||||
|
} else {
|
||||||
|
for (size_t j = 0; j < cur_wi.len; ++j)
|
||||||
|
if ((grid.at(cur_wi.x + j).at(cur_wi.y) != TRANS_CLEAR) &&
|
||||||
|
(grid.at(cur_wi.x + j).at(cur_wi.y) != cur_word.at(j)))
|
||||||
|
can_write = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (can_write) {
|
||||||
|
UsedWords t_used(used);
|
||||||
|
t_used.insert(getWordUniq(icw,cur_len));
|
||||||
|
|
||||||
|
WorkGridType t_grid(grid);
|
||||||
|
|
||||||
|
if ( cur_wi.direct ){
|
||||||
|
for (size_t j = 0; j < cur_wi.len; ++j)
|
||||||
|
t_grid.at(cur_wi.x + j).at(cur_wi.y) = cur_word.at(j);
|
||||||
|
} else {
|
||||||
|
for (size_t j = 0; j < cur_wi.len; ++j)
|
||||||
|
t_grid.at(cur_wi.x).at(j + cur_wi.y) = cur_word.at(j);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (procCross(t_used, words, t_grid, winfos, cur_word_ind + 1, out)){
|
||||||
|
out.push_back(cur_word);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void generateCross(const GridType &grid, const AllWordsType &words,
|
||||||
|
const CharsTransType &trans_type, std::vector<wxString> &words_out){
|
||||||
|
|
||||||
|
std::vector<WordInfo> winfos;
|
||||||
|
generateWordInfo(grid, winfos);
|
||||||
|
for (size_t i = 0; i < winfos.size(); ++i)
|
||||||
|
wxLogDebug(wxT("Word at (%d,%d) with len = %d and index = %d and dir = %d"),
|
||||||
|
winfos.at(i).x,winfos.at(i).y,winfos.at(i).len, winfos.at(i).ind, int(winfos.at(i).direct));
|
||||||
|
|
||||||
|
WorkGridType grid_work;
|
||||||
|
toWorkGridType(grid, grid_work);
|
||||||
|
UsedWords t_used;
|
||||||
|
std::vector< TransedWord > words_trans_out;
|
||||||
|
procCross(t_used, words, grid_work, winfos, 0, words_trans_out);
|
||||||
|
std::reverse(words_trans_out.begin(), words_trans_out.end());
|
||||||
|
BackedCharsTransType bctt = getFromCharsTransed(trans_type);
|
||||||
|
words_out.clear();
|
||||||
|
words_out.resize(words_trans_out.size());
|
||||||
|
std::transform(
|
||||||
|
words_trans_out.begin(),
|
||||||
|
words_trans_out.end(),
|
||||||
|
words_out.begin(), [bctt](const TransedWord &tw){
|
||||||
|
return getFromTransed(tw, bctt);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
240
src/crossgen.hpp
240
src/crossgen.hpp
@@ -11,168 +11,26 @@
|
|||||||
|
|
||||||
#include "crossbasetypes.hpp"
|
#include "crossbasetypes.hpp"
|
||||||
|
|
||||||
const wxChar CELL_CLEAR = wxT('+');
|
extern const wxChar CELL_CLEAR ;
|
||||||
const wxChar CELL_BORDER = wxT('-');
|
extern const wxChar CELL_BORDER ;
|
||||||
const TransedChar TRANS_CLEAR = 0;
|
extern const TransedChar TRANS_CLEAR ;
|
||||||
const TransedChar TRANS_BORDER = 1;
|
extern const TransedChar TRANS_BORDER ;
|
||||||
const uint32_t MAX_WORD_COUNT = 262144; // =2^18
|
extern const uint32_t MAX_WORD_COUNT ;
|
||||||
|
|
||||||
void readDict(const wxString path, DictType &dict_out){
|
void readDict(const wxString path, DictType &dict_out);
|
||||||
wxTextFile f;
|
|
||||||
f.Open(path);
|
|
||||||
for ( wxString str = f.GetFirstLine(); !f.Eof(); str = f.GetNextLine() ) {
|
|
||||||
wxString key,val;
|
|
||||||
int del_ind = str.Index('-');
|
|
||||||
key = str.Left(del_ind-1);
|
|
||||||
val = str.Right(str.size() - del_ind - 2);
|
|
||||||
dict_out[key] = val;
|
|
||||||
}
|
|
||||||
f.Close();
|
|
||||||
};
|
|
||||||
|
|
||||||
void readGrid(const wxString path, GridType &grid){
|
void readGrid(const wxString path, GridType &grid);
|
||||||
wxTextFile f;
|
|
||||||
f.Open(path);
|
|
||||||
wxString str = f.GetFirstLine();
|
|
||||||
|
|
||||||
grid.resize(str.size());
|
|
||||||
for (unsigned int i = 0; i < grid.size(); ++i)
|
|
||||||
grid.at(i).resize(f.GetLineCount());
|
|
||||||
|
|
||||||
wxLogDebug(wxT("Total lines: %d. First line is %s and size = %d"),f.GetLineCount(), str.c_str(),str.size());
|
|
||||||
unsigned int i = 0;
|
|
||||||
for ( ; !f.Eof(); str = f.GetNextLine() ) {
|
|
||||||
wxLogDebug(str);
|
|
||||||
for (unsigned int j = 0; j < str.size(); ++j)
|
|
||||||
grid.at(j).at(i) = str.at(j);
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
wxLogDebug(wxT("Прочитана сетка размером %d x %d"),
|
|
||||||
static_cast<int>(grid.size()), static_cast<int>(grid.at(0).size()));
|
|
||||||
f.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString getFromTransed(const TransedWord &tw, const BackedCharsTransType &bchar_trans){
|
wxString getFromTransed(const TransedWord &tw, const BackedCharsTransType &bchar_trans);
|
||||||
wxString s;
|
|
||||||
s.resize(tw.size());
|
|
||||||
for (size_t i = 0; i < tw.size(); ++i){
|
|
||||||
s[i] = bchar_trans.at(tw.at(i));
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
BackedCharsTransType getFromCharsTransed(const CharsTransType &char_trans){
|
BackedCharsTransType getFromCharsTransed(const CharsTransType &char_trans);
|
||||||
BackedCharsTransType t;
|
|
||||||
for (auto it = char_trans.begin(); it != char_trans.end(); ++it)
|
|
||||||
t[it->second] = it->first;
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
void toWorkGridType(const GridType &grid, WorkGridType &grid_out){
|
void toWorkGridType(const GridType &grid, WorkGridType &grid_out);
|
||||||
grid_out.clear();
|
|
||||||
grid_out.resize(grid.size());
|
|
||||||
for (size_t i = 0; i < grid.size(); ++i){
|
|
||||||
grid_out.at(i).resize(grid.at(0).size());
|
|
||||||
for (size_t j = 0; j < grid.at(0).size(); ++j){
|
|
||||||
if ( grid.at(i).at(j) == CELL_CLEAR )
|
|
||||||
grid_out.at(i).at(j) = TRANS_CLEAR;
|
|
||||||
else
|
|
||||||
grid_out.at(i).at(j) = TRANS_BORDER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void generateAllWords(const DictType &dict, AllWordsType &words_out,
|
void generateAllWords(const DictType &dict, AllWordsType &words_out,
|
||||||
CharsTransType &char_trans_out){
|
CharsTransType &char_trans_out);
|
||||||
words_out.clear();
|
|
||||||
char_trans_out.clear();
|
|
||||||
char_trans_out[CELL_CLEAR] = TRANS_CLEAR;
|
|
||||||
char_trans_out[CELL_BORDER] = TRANS_BORDER;
|
|
||||||
static_assert(TRANS_CLEAR + 1 == TRANS_BORDER, "TRANS_CLEAR + 1 != TRANS_BORDER");
|
|
||||||
TransedChar st = TRANS_BORDER + 1;
|
|
||||||
for (auto it = dict.begin(); it != dict.end(); ++it){
|
|
||||||
if ( words_out.size() <= it->first.size() )
|
|
||||||
words_out.resize(it->first.size() + 2);
|
|
||||||
TransedWord t_tw(it->first.size());
|
|
||||||
for (size_t i = 0; i < it->first.size(); ++i){
|
|
||||||
auto cur_ch = it->first.at(i);
|
|
||||||
if ( char_trans_out.find(cur_ch) == char_trans_out.end() ){
|
|
||||||
char_trans_out[cur_ch] = st;
|
|
||||||
++st;
|
|
||||||
}
|
|
||||||
t_tw.at(i) = char_trans_out[cur_ch];
|
|
||||||
}
|
|
||||||
words_out.at(it->first.size()).push_back(t_tw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void generateWordInfo(const GridType &grid, std::vector<WordInfo> &winfos_out){
|
void generateWordInfo(const GridType &grid, std::vector<WordInfo> &winfos_out);
|
||||||
wxLogDebug(wxT("Printing grid: "));
|
|
||||||
for (size_t i = 0; i < grid.size(); ++i){
|
|
||||||
wxString st;
|
|
||||||
for (size_t j = 0; j < grid.at(0).size(); ++j)
|
|
||||||
st += grid.at(i).at(j);
|
|
||||||
wxLogDebug(st);
|
|
||||||
}
|
|
||||||
size_t cur_ind = 1;
|
|
||||||
bool exist = false;
|
|
||||||
auto y_len = grid.at(0).size();
|
|
||||||
auto x_len = grid.size();
|
|
||||||
for (size_t j = 0; j < y_len; ++j){
|
|
||||||
for (size_t i = 0; i < x_len; ++i){
|
|
||||||
if ( grid.at(i).at(j) == CELL_CLEAR ) {
|
|
||||||
if ( ((j == 0) || (grid.at(i).at(j - 1) != CELL_CLEAR)) &&
|
|
||||||
(j !=y_len - 1) )
|
|
||||||
if ( grid.at(i).at(j+1) == CELL_CLEAR ) {
|
|
||||||
size_t cur_len = 1;
|
|
||||||
bool cont = true;
|
|
||||||
while ( (j + cur_len < y_len) && cont ) {
|
|
||||||
++cur_len;
|
|
||||||
if ( grid.at(i).at(j+cur_len-1) != CELL_CLEAR ) {
|
|
||||||
cont = false;
|
|
||||||
--cur_len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exist = true;
|
|
||||||
|
|
||||||
WordInfo t;
|
|
||||||
t.x = i;
|
|
||||||
t.y = j;
|
|
||||||
t.len = cur_len;
|
|
||||||
t.ind = cur_ind;
|
|
||||||
t.direct = false;
|
|
||||||
winfos_out.push_back(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ((i ==0) || (grid.at(i - 1).at(j) != CELL_CLEAR)) &&
|
|
||||||
(i != x_len - 1) )
|
|
||||||
if ( grid.at(i + 1).at(j) == CELL_CLEAR ){
|
|
||||||
size_t cur_len = 1;
|
|
||||||
bool cont = true;
|
|
||||||
while ((i + cur_len < x_len) && cont){
|
|
||||||
++cur_len;
|
|
||||||
if (grid.at(i+cur_len-1).at(j) != CELL_CLEAR){
|
|
||||||
cont = false;
|
|
||||||
--cur_len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exist = true;
|
|
||||||
WordInfo t;
|
|
||||||
t.x = i;
|
|
||||||
t.y = j;
|
|
||||||
t.len = cur_len;
|
|
||||||
t.ind = cur_ind;
|
|
||||||
t.direct = true;
|
|
||||||
winfos_out.push_back(t);
|
|
||||||
}
|
|
||||||
if ( exist ){
|
|
||||||
exist = false;
|
|
||||||
++cur_ind;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
uint32_t getWordUniq(const T &w_ind, const T &w_len){
|
uint32_t getWordUniq(const T &w_ind, const T &w_len){
|
||||||
@@ -186,79 +44,9 @@ bool procCross(
|
|||||||
const std::vector<WordInfo> &winfos,
|
const std::vector<WordInfo> &winfos,
|
||||||
const size_t cur_word_ind,
|
const size_t cur_word_ind,
|
||||||
std::vector<TransedWord> &out
|
std::vector<TransedWord> &out
|
||||||
){
|
);
|
||||||
if (cur_word_ind == winfos.size())
|
|
||||||
return true;
|
|
||||||
WordInfo cur_wi = winfos.at(cur_word_ind);
|
|
||||||
size_t rand_add = rand() % 100000;
|
|
||||||
size_t cur_len = cur_wi.len;
|
|
||||||
size_t cur_words_size = words.at(cur_len).size();
|
|
||||||
for (size_t icw = 0; icw < cur_words_size; ++icw){
|
|
||||||
if (used.find(getWordUniq(icw,cur_len)) != used.end())
|
|
||||||
continue;
|
|
||||||
TransedWord cur_word = words.at(cur_len).at((icw + rand_add) % cur_words_size);
|
|
||||||
// Показывает, можно ли записать это слово в сетку
|
|
||||||
bool can_write = true;
|
|
||||||
if ( cur_wi.direct == false ){
|
|
||||||
for (size_t j = 0; j < cur_wi.len; ++j)
|
|
||||||
if ((grid.at(cur_wi.x).at(j + cur_wi.y) != TRANS_CLEAR) &&
|
|
||||||
(grid.at(cur_wi.x).at(j + cur_wi.y) != cur_word.at(j)))
|
|
||||||
can_write = false;
|
|
||||||
} else {
|
|
||||||
for (size_t j = 0; j < cur_wi.len; ++j)
|
|
||||||
if ((grid.at(cur_wi.x + j).at(cur_wi.y) != TRANS_CLEAR) &&
|
|
||||||
(grid.at(cur_wi.x + j).at(cur_wi.y) != cur_word.at(j)))
|
|
||||||
can_write = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (can_write) {
|
|
||||||
UsedWords t_used(used);
|
|
||||||
t_used.insert(getWordUniq(icw,cur_len));
|
|
||||||
|
|
||||||
WorkGridType t_grid(grid);
|
|
||||||
|
|
||||||
if ( cur_wi.direct ){
|
|
||||||
for (size_t j = 0; j < cur_wi.len; ++j)
|
|
||||||
t_grid.at(cur_wi.x + j).at(cur_wi.y) = cur_word.at(j);
|
|
||||||
} else {
|
|
||||||
for (size_t j = 0; j < cur_wi.len; ++j)
|
|
||||||
t_grid.at(cur_wi.x).at(j + cur_wi.y) = cur_word.at(j);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (procCross(t_used, words, t_grid, winfos, cur_word_ind + 1, out)){
|
|
||||||
out.push_back(cur_word);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void generateCross(const GridType &grid, const AllWordsType &words,
|
void generateCross(const GridType &grid, const AllWordsType &words,
|
||||||
const CharsTransType &trans_type, std::vector<wxString> &words_out){
|
const CharsTransType &trans_type, std::vector<wxString> &words_out);
|
||||||
|
|
||||||
std::vector<WordInfo> winfos;
|
|
||||||
generateWordInfo(grid, winfos);
|
|
||||||
for (size_t i = 0; i < winfos.size(); ++i)
|
|
||||||
wxLogDebug(wxT("Word at (%d,%d) with len = %d and index = %d and dir = %d"),
|
|
||||||
winfos.at(i).x,winfos.at(i).y,winfos.at(i).len, winfos.at(i).ind, int(winfos.at(i).direct));
|
|
||||||
|
|
||||||
WorkGridType grid_work;
|
|
||||||
toWorkGridType(grid, grid_work);
|
|
||||||
UsedWords t_used;
|
|
||||||
std::vector< TransedWord > words_trans_out;
|
|
||||||
procCross(t_used, words, grid_work, winfos, 0, words_trans_out);
|
|
||||||
std::reverse(words_trans_out.begin(), words_trans_out.end());
|
|
||||||
BackedCharsTransType bctt = getFromCharsTransed(trans_type);
|
|
||||||
words_out.clear();
|
|
||||||
words_out.resize(words_trans_out.size());
|
|
||||||
std::transform(
|
|
||||||
words_trans_out.begin(),
|
|
||||||
words_trans_out.end(),
|
|
||||||
words_out.begin(), [bctt](const TransedWord &tw){
|
|
||||||
return getFromTransed(tw, bctt);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // CROSSGEN_HPP
|
#endif // CROSSGEN_HPP
|
||||||
|
|||||||
185
wxCrossGen/fmain.cpp
Normal file
185
wxCrossGen/fmain.cpp
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
#include "fmain.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
void MainFrame::procDict(wxString path){
|
||||||
|
_dict.clear();
|
||||||
|
_allWords.clear();
|
||||||
|
_transType.clear();
|
||||||
|
readDict(path, _dict);
|
||||||
|
generateAllWords(_dict, _allWords, _transType);
|
||||||
|
_isDictLoaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainFrame::onOpenGridClick(wxCommandEvent &event) {
|
||||||
|
wxFileDialog dlgOpen(this, _("Open crossword file"), wxEmptyString, wxEmptyString,
|
||||||
|
_("Files of crossword (*.cross)|*.cross"), wxFD_OPEN|wxFD_FILE_MUST_EXIST);
|
||||||
|
|
||||||
|
if ( dlgOpen.ShowModal() == wxID_CANCEL )
|
||||||
|
return;
|
||||||
|
wxFileInputStream input_stream(dlgOpen.GetPath());
|
||||||
|
if ( !input_stream.IsOk() ) {
|
||||||
|
wxMessageBox(_("Cannot open file ") + dlgOpen.GetPath(), _("Error"), wxICON_ERROR );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tPath->SetValue(dlgOpen.GetPath());
|
||||||
|
|
||||||
|
// Clearing
|
||||||
|
_grid.clear();
|
||||||
|
_ques.clear();
|
||||||
|
_ans.clear();
|
||||||
|
tOutput->Clear();
|
||||||
|
|
||||||
|
readGrid(tPath->GetValue(), _grid);
|
||||||
|
|
||||||
|
SetGridImage(_grid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainFrame::SetGridImage(GridType &grid, size_t w) {
|
||||||
|
size_t h = static_cast<float>(w) / grid.size() * grid.at(0).size();
|
||||||
|
wxBitmap bmp(w, h);
|
||||||
|
wxMemoryDC dc;
|
||||||
|
dc.SelectObject(bmp);
|
||||||
|
dc.Clear();
|
||||||
|
|
||||||
|
std::vector<WordInfo> winfos;
|
||||||
|
generateWordInfo(grid, winfos);
|
||||||
|
|
||||||
|
float sq_w = static_cast<int>(static_cast<float>(w) / grid.size());
|
||||||
|
float sq_h = static_cast<int>(static_cast<float>(h) / grid.at(0).size());
|
||||||
|
|
||||||
|
wxFont cur_f = dc.GetFont();
|
||||||
|
cur_f.SetPointSize(sq_h/3);
|
||||||
|
|
||||||
|
dc.SetBrush(wxBrush(wxColour(217,231,200)));
|
||||||
|
dc.SetFont(cur_f);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < grid.size(); ++i){
|
||||||
|
for (size_t j = 0; j < grid.at(0).size(); ++j){
|
||||||
|
if (grid.at(i).at(j) == CELL_CLEAR)
|
||||||
|
dc.DrawRectangle(sq_w*i,sq_h*j,sq_w+1,sq_h+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < winfos.size(); ++i) {
|
||||||
|
dc.DrawText(wxString::Format(wxT("%d"),winfos.at(i).ind), sq_w*winfos.at(i).x, sq_h*winfos.at(i).y);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( _ans.size() > 0 ) {
|
||||||
|
using std::vector;
|
||||||
|
vector< vector< bool > > usedCells(
|
||||||
|
grid.size(),
|
||||||
|
vector<bool>(grid.at(0).size(), false)
|
||||||
|
);
|
||||||
|
cur_f = dc.GetFont();
|
||||||
|
cur_f.SetPointSize(sq_h*0.6);
|
||||||
|
dc.SetFont(cur_f);
|
||||||
|
for ( size_t i = 0; i < winfos.size(); ++i ) {
|
||||||
|
if ( winfos.at(i).direct == true ) {
|
||||||
|
for (size_t j = 0; j < winfos.at(i).len; ++j)
|
||||||
|
if ( !usedCells.at(winfos.at(i).x+j).at(winfos.at(i).y) ) {
|
||||||
|
dc.DrawText(
|
||||||
|
_ans.at(i).at(j),
|
||||||
|
sq_w*(winfos.at(i).x+j) + sq_w*0.24,
|
||||||
|
sq_h*winfos.at(i).y
|
||||||
|
);
|
||||||
|
usedCells.at(winfos.at(i).x+j).at(winfos.at(i).y) = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (size_t j = 0; j < winfos.at(i).len; ++j)
|
||||||
|
if ( !usedCells.at(winfos.at(i).x).at(winfos.at(i).y+j) ) {
|
||||||
|
dc.DrawText(
|
||||||
|
_ans.at(i).at(j),
|
||||||
|
sq_w*winfos.at(i).x + sq_w*0.24,
|
||||||
|
sq_h*(winfos.at(i).y+j)
|
||||||
|
);
|
||||||
|
usedCells.at(winfos.at(i).x).at(winfos.at(i).y+j) = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bPreview->SetBitmap(bmp);
|
||||||
|
bPreview->Show();
|
||||||
|
|
||||||
|
dc.SelectObject( wxNullBitmap );
|
||||||
|
|
||||||
|
this->Refresh();
|
||||||
|
this->GetSizer()->RecalcSizes();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainFrame::onGenerateClick(wxCommandEvent &event) {
|
||||||
|
auto config = wxConfigBase::Get();
|
||||||
|
if ( !_isDictLoaded ) {
|
||||||
|
procDict(config->Read(SETTINGS_KEY_DICT_PATH, SETTINGS_DEFAULT_DICTPATH));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<wxString> words_out;
|
||||||
|
if ( _dict.empty() ){
|
||||||
|
wxMessageBox( _("Crossword grid isn't loaded!"), _("Info"), wxICON_INFORMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
generateCross(_grid, _allWords, _transType, words_out);
|
||||||
|
|
||||||
|
_ans = words_out;
|
||||||
|
|
||||||
|
std::vector<WordInfo> winfos;
|
||||||
|
generateWordInfo(_grid, winfos);
|
||||||
|
|
||||||
|
_ques.clear();
|
||||||
|
for (size_t i = 0; i < words_out.size(); ++i)
|
||||||
|
_ques.push_back(_dict[words_out.at(i)]);
|
||||||
|
|
||||||
|
tOutput->Clear();
|
||||||
|
|
||||||
|
FilledCrossword t_cross;
|
||||||
|
t_cross.words = winfos;
|
||||||
|
t_cross.grid = _grid;
|
||||||
|
t_cross.ans = _ans;
|
||||||
|
t_cross.ques = _ques;
|
||||||
|
|
||||||
|
tOutput->AppendText(getQuesString(t_cross));
|
||||||
|
|
||||||
|
if (winfos.size() == 0)
|
||||||
|
throw 42;
|
||||||
|
SetGridImage(_grid);
|
||||||
|
}
|
||||||
|
catch ( ... ){
|
||||||
|
tOutput->Clear();
|
||||||
|
wxMessageBox( _("Cannot generate crossword"), _("Error"), wxICON_ERROR );
|
||||||
|
}
|
||||||
|
this->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainFrame::onExportClick(wxCommandEvent& event) {
|
||||||
|
if ( _grid.size() == 0 ) {
|
||||||
|
wxMessageBox( _("Grid isn't loaded now"), _("Info"), wxICON_INFORMATION );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wxFileDialog dlgSave(this, _("Exporting crossword"), wxEmptyString, wxEmptyString,
|
||||||
|
_("txt files (*.txt)|*.txt"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||||
|
if (dlgSave.ShowModal() == wxID_CANCEL)
|
||||||
|
return;
|
||||||
|
FilledCrossword t_cross;
|
||||||
|
t_cross.grid = _grid;
|
||||||
|
t_cross.ans = _ans;
|
||||||
|
t_cross.ques = _ques;
|
||||||
|
generateWordInfo(_grid, t_cross.words);
|
||||||
|
if ( !exportToFile(t_cross, dlgSave.GetPath()) ){
|
||||||
|
wxLogError(wxT("Cannot save current contents in file '%s'."), dlgSave.GetPath().GetData());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wxLogDebug(wxT("Exporting to ") + dlgSave.GetPath() + wxT(" is complete"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainFrame::onSettingsClick( wxCommandEvent& event ){
|
||||||
|
SettingsDialog fSettings(this);
|
||||||
|
auto *config = wxConfigBase::Get();
|
||||||
|
fSettings.setDictPath(config->Read(SETTINGS_KEY_DICT_PATH, SETTINGS_DEFAULT_DICTPATH));
|
||||||
|
if ( fSettings.ShowModal() == wxID_OK ){
|
||||||
|
if ( config->Read(SETTINGS_KEY_DICT_PATH, SETTINGS_DEFAULT_DICTPATH) != fSettings.getDictPath() ) {
|
||||||
|
config->Write(SETTINGS_KEY_DICT_PATH, fSettings.getDictPath());
|
||||||
|
procDict(fSettings.getDictPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#ifndef WXGUI_HPP
|
#ifndef FMAIN_HPP
|
||||||
#define WXGUI_HPP
|
#define FMAIN_HPP
|
||||||
|
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <map>
|
#include <map>
|
||||||
@@ -7,13 +8,15 @@
|
|||||||
#include <wx/image.h>
|
#include <wx/image.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <wx/aboutdlg.h>
|
#include <wx/aboutdlg.h>
|
||||||
|
#include <wx/fileconf.h>
|
||||||
|
|
||||||
#include "fbgui/fbgui.h"
|
#include "fbgui/fbgui.h"
|
||||||
|
|
||||||
|
#include "settingsconsts.hpp"
|
||||||
#include "crossgen.hpp"
|
#include "crossgen.hpp"
|
||||||
|
#include "crossexport.hpp"
|
||||||
#include "fsettings.hpp"
|
#include "fsettings.hpp"
|
||||||
|
|
||||||
|
|
||||||
#ifndef APP_CATALOG
|
#ifndef APP_CATALOG
|
||||||
#define APP_CATALOG "app" // replace with the appropriate catalog name
|
#define APP_CATALOG "app" // replace with the appropriate catalog name
|
||||||
#endif
|
#endif
|
||||||
@@ -59,4 +62,4 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WXGUI_HPP
|
#endif // FMAIN_HPP
|
||||||
25
wxCrossGen/fsettings.cpp
Normal file
25
wxCrossGen/fsettings.cpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#include "fsettings.hpp"
|
||||||
|
|
||||||
|
void SettingsDialog::onDictPathClick(wxCommandEvent& event) {
|
||||||
|
wxFileDialog dlgOpen(this, _("Open dictionary file"), wxEmptyString, wxEmptyString,
|
||||||
|
_("Files of dictionaris (*.txt)|*.txt"), wxFD_OPEN|wxFD_FILE_MUST_EXIST);
|
||||||
|
|
||||||
|
if ( dlgOpen.ShowModal() == wxID_CANCEL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxFileInputStream input_stream(dlgOpen.GetPath());
|
||||||
|
if ( !input_stream.IsOk() ) {
|
||||||
|
wxMessageBox(_("Cannot open dictionary file ") + dlgOpen.GetPath(), _("Error"), wxICON_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tDictPath->SetValue(dlgOpen.GetPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::onOkClick(wxCommandEvent& event) {
|
||||||
|
wxFileInputStream input_stream(tDictPath->GetValue());
|
||||||
|
if ( !input_stream.IsOk() ) {
|
||||||
|
wxMessageBox(_("Cannot open dictionary file ") + tDictPath->GetValue(), _("Error"), wxICON_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EndModal(wxID_OK);
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
#define FSETTINGS_HPP
|
#define FSETTINGS_HPP
|
||||||
|
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
|
#include <wx/wfstream.h>
|
||||||
|
|
||||||
#include "fbgui/fbgui.h"
|
#include "fbgui/fbgui.h"
|
||||||
|
|
||||||
@@ -23,28 +24,4 @@ class SettingsDialog: public VSettingsDialog {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void SettingsDialog::onDictPathClick(wxCommandEvent& event) {
|
#endif // FSETTINGS_HPP
|
||||||
wxFileDialog dlgOpen(this, _("Open dictionary file"), wxEmptyString, wxEmptyString,
|
|
||||||
_("Files of dictionaris (*.txt)|*.txt"), wxFD_OPEN|wxFD_FILE_MUST_EXIST);
|
|
||||||
|
|
||||||
if ( dlgOpen.ShowModal() == wxID_CANCEL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
wxFileInputStream input_stream(dlgOpen.GetPath());
|
|
||||||
if ( !input_stream.IsOk() ) {
|
|
||||||
wxMessageBox(_("Cannot open dictionary file ") + dlgOpen.GetPath(), _("Error"), wxICON_ERROR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tDictPath->SetValue(dlgOpen.GetPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsDialog::onOkClick(wxCommandEvent& event) {
|
|
||||||
wxFileInputStream input_stream(tDictPath->GetValue());
|
|
||||||
if ( !input_stream.IsOk() ) {
|
|
||||||
wxMessageBox(_("Cannot open dictionary file ") + tDictPath->GetValue(), _("Error"), wxICON_ERROR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
EndModal(wxID_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -8,195 +8,14 @@
|
|||||||
#include <wx/wfstream.h>
|
#include <wx/wfstream.h>
|
||||||
#include <wx/textfile.h>
|
#include <wx/textfile.h>
|
||||||
#include <wx/fileconf.h>
|
#include <wx/fileconf.h>
|
||||||
#include "wxgui.hpp"
|
|
||||||
|
#include "fsettings.hpp"
|
||||||
|
#include "fmain.hpp"
|
||||||
|
|
||||||
#include "crossgen.hpp"
|
#include "crossgen.hpp"
|
||||||
#include "crossexport.hpp"
|
#include "crossexport.hpp"
|
||||||
#include "settingsconsts.hpp"
|
#include "settingsconsts.hpp"
|
||||||
|
|
||||||
void MainFrame::procDict(wxString path){
|
|
||||||
_dict.clear();
|
|
||||||
_allWords.clear();
|
|
||||||
_transType.clear();
|
|
||||||
readDict(path, _dict);
|
|
||||||
generateAllWords(_dict, _allWords, _transType);
|
|
||||||
_isDictLoaded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainFrame::onOpenGridClick(wxCommandEvent &event) {
|
|
||||||
wxFileDialog dlgOpen(this, _("Open crossword file"), wxEmptyString, wxEmptyString,
|
|
||||||
_("Files of crossword (*.cross)|*.cross"), wxFD_OPEN|wxFD_FILE_MUST_EXIST);
|
|
||||||
|
|
||||||
if ( dlgOpen.ShowModal() == wxID_CANCEL )
|
|
||||||
return;
|
|
||||||
wxFileInputStream input_stream(dlgOpen.GetPath());
|
|
||||||
if ( !input_stream.IsOk() ) {
|
|
||||||
wxMessageBox(_("Cannot open file ") + dlgOpen.GetPath(), _("Error"), wxICON_ERROR );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tPath->SetValue(dlgOpen.GetPath());
|
|
||||||
|
|
||||||
// Clearing
|
|
||||||
_grid.clear();
|
|
||||||
_ques.clear();
|
|
||||||
_ans.clear();
|
|
||||||
tOutput->Clear();
|
|
||||||
|
|
||||||
readGrid(tPath->GetValue(), _grid);
|
|
||||||
|
|
||||||
SetGridImage(_grid);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainFrame::SetGridImage(GridType &grid, size_t w) {
|
|
||||||
size_t h = static_cast<float>(w) / grid.size() * grid.at(0).size();
|
|
||||||
wxBitmap bmp(w, h);
|
|
||||||
wxMemoryDC dc;
|
|
||||||
dc.SelectObject(bmp);
|
|
||||||
dc.Clear();
|
|
||||||
|
|
||||||
std::vector<WordInfo> winfos;
|
|
||||||
generateWordInfo(grid, winfos);
|
|
||||||
|
|
||||||
float sq_w = static_cast<int>(static_cast<float>(w) / grid.size());
|
|
||||||
float sq_h = static_cast<int>(static_cast<float>(h) / grid.at(0).size());
|
|
||||||
|
|
||||||
wxFont cur_f = dc.GetFont();
|
|
||||||
cur_f.SetPointSize(sq_h/3);
|
|
||||||
|
|
||||||
dc.SetBrush(wxBrush(wxColour(217,231,200)));
|
|
||||||
dc.SetFont(cur_f);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < grid.size(); ++i){
|
|
||||||
for (size_t j = 0; j < grid.at(0).size(); ++j){
|
|
||||||
if (grid.at(i).at(j) == CELL_CLEAR)
|
|
||||||
dc.DrawRectangle(sq_w*i,sq_h*j,sq_w+1,sq_h+1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < winfos.size(); ++i) {
|
|
||||||
dc.DrawText(wxString::Format(wxT("%d"),winfos.at(i).ind), sq_w*winfos.at(i).x, sq_h*winfos.at(i).y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( _ans.size() > 0 ) {
|
|
||||||
using std::vector;
|
|
||||||
vector< vector< bool > > usedCells(
|
|
||||||
grid.size(),
|
|
||||||
vector<bool>(grid.at(0).size(), false)
|
|
||||||
);
|
|
||||||
cur_f = dc.GetFont();
|
|
||||||
cur_f.SetPointSize(sq_h*0.6);
|
|
||||||
dc.SetFont(cur_f);
|
|
||||||
for ( size_t i = 0; i < winfos.size(); ++i ) {
|
|
||||||
if ( winfos.at(i).direct == true ) {
|
|
||||||
for (size_t j = 0; j < winfos.at(i).len; ++j)
|
|
||||||
if ( !usedCells.at(winfos.at(i).x+j).at(winfos.at(i).y) ) {
|
|
||||||
dc.DrawText(
|
|
||||||
_ans.at(i).at(j),
|
|
||||||
sq_w*(winfos.at(i).x+j) + sq_w*0.24,
|
|
||||||
sq_h*winfos.at(i).y
|
|
||||||
);
|
|
||||||
usedCells.at(winfos.at(i).x+j).at(winfos.at(i).y) = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (size_t j = 0; j < winfos.at(i).len; ++j)
|
|
||||||
if ( !usedCells.at(winfos.at(i).x).at(winfos.at(i).y+j) ) {
|
|
||||||
dc.DrawText(
|
|
||||||
_ans.at(i).at(j),
|
|
||||||
sq_w*winfos.at(i).x + sq_w*0.24,
|
|
||||||
sq_h*(winfos.at(i).y+j)
|
|
||||||
);
|
|
||||||
usedCells.at(winfos.at(i).x).at(winfos.at(i).y+j) = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bPreview->SetBitmap(bmp);
|
|
||||||
bPreview->Show();
|
|
||||||
|
|
||||||
dc.SelectObject( wxNullBitmap );
|
|
||||||
|
|
||||||
this->Refresh();
|
|
||||||
this->GetSizer()->RecalcSizes();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainFrame::onGenerateClick(wxCommandEvent &event) {
|
|
||||||
auto config = wxConfigBase::Get();
|
|
||||||
if ( !_isDictLoaded ) {
|
|
||||||
procDict(config->Read(SETTINGS_KEY_DICT_PATH, SETTINGS_DEFAULT_DICTPATH));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<wxString> words_out;
|
|
||||||
if ( _dict.size() == 0 ){
|
|
||||||
wxMessageBox( _("Crossword grid isn't loaded!"), _("Info"), wxICON_INFORMATION);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
generateCross(_grid, _allWords, _transType, words_out);
|
|
||||||
|
|
||||||
_ans = words_out;
|
|
||||||
|
|
||||||
std::vector<WordInfo> winfos;
|
|
||||||
generateWordInfo(_grid, winfos);
|
|
||||||
|
|
||||||
_ques.clear();
|
|
||||||
for (size_t i = 0; i < words_out.size(); ++i)
|
|
||||||
_ques.push_back(_dict[words_out.at(i)]);
|
|
||||||
|
|
||||||
tOutput->Clear();
|
|
||||||
|
|
||||||
FilledCrossword t_cross;
|
|
||||||
t_cross.words = winfos;
|
|
||||||
t_cross.grid = _grid;
|
|
||||||
t_cross.ans = _ans;
|
|
||||||
t_cross.ques = _ques;
|
|
||||||
|
|
||||||
tOutput->AppendText(getQuesString(t_cross));
|
|
||||||
|
|
||||||
if (winfos.size() == 0)
|
|
||||||
throw 42;
|
|
||||||
SetGridImage(_grid);
|
|
||||||
}
|
|
||||||
catch ( ... ){
|
|
||||||
tOutput->Clear();
|
|
||||||
wxMessageBox( _("Cannot generate crossword"), _("Error"), wxICON_ERROR );
|
|
||||||
}
|
|
||||||
this->Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainFrame::onExportClick(wxCommandEvent& event) {
|
|
||||||
if ( _grid.size() == 0 ) {
|
|
||||||
wxMessageBox( _("Grid isn't loaded now"), _("Info"), wxICON_INFORMATION );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wxFileDialog dlgSave(this, _("Exporting crossword"), wxEmptyString, wxEmptyString,
|
|
||||||
_("txt files (*.txt)|*.txt"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
|
||||||
if (dlgSave.ShowModal() == wxID_CANCEL)
|
|
||||||
return;
|
|
||||||
FilledCrossword t_cross;
|
|
||||||
t_cross.grid = _grid;
|
|
||||||
t_cross.ans = _ans;
|
|
||||||
t_cross.ques = _ques;
|
|
||||||
generateWordInfo(_grid, t_cross.words);
|
|
||||||
if ( !exportToFile(t_cross, dlgSave.GetPath()) ){
|
|
||||||
wxLogError(wxT("Cannot save current contents in file '%s'."), dlgSave.GetPath().GetData());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wxLogDebug(wxT("Exporting to ") + dlgSave.GetPath() + wxT(" is complete"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainFrame::onSettingsClick( wxCommandEvent& event ){
|
|
||||||
SettingsDialog fSettings(this);
|
|
||||||
auto *config = wxConfigBase::Get();
|
|
||||||
fSettings.setDictPath(config->Read(SETTINGS_KEY_DICT_PATH, SETTINGS_DEFAULT_DICTPATH));
|
|
||||||
if ( fSettings.ShowModal() == wxID_OK ){
|
|
||||||
if ( config->Read(SETTINGS_KEY_DICT_PATH, SETTINGS_DEFAULT_DICTPATH) != fSettings.getDictPath() ) {
|
|
||||||
config->Write(SETTINGS_KEY_DICT_PATH, fSettings.getDictPath());
|
|
||||||
procDict(fSettings.getDictPath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MyApp: public wxApp {
|
class MyApp: public wxApp {
|
||||||
public:
|
public:
|
||||||
bool OnInit();
|
bool OnInit();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ CurrentFileName :=
|
|||||||
CurrentFilePath :=
|
CurrentFilePath :=
|
||||||
CurrentFileFullPath :=
|
CurrentFileFullPath :=
|
||||||
User :=Aleksey Lobanov
|
User :=Aleksey Lobanov
|
||||||
Date :=19/06/15
|
Date :=20/06/15
|
||||||
CodeLitePath :="/home/alex/.codelite"
|
CodeLitePath :="/home/alex/.codelite"
|
||||||
LinkerName :=/usr/bin/g++-4.8
|
LinkerName :=/usr/bin/g++-4.8
|
||||||
SharedObjectLinkerName :=/usr/bin/g++-4.8 -shared -fPIC
|
SharedObjectLinkerName :=/usr/bin/g++-4.8 -shared -fPIC
|
||||||
@@ -60,7 +60,7 @@ AS := /usr/bin/as
|
|||||||
## User defined environment variables
|
## User defined environment variables
|
||||||
##
|
##
|
||||||
CodeLiteDir:=/usr/share/codelite
|
CodeLiteDir:=/usr/share/codelite
|
||||||
Objects0=$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IntermediateDirectory)/fbgui_fbgui.cpp$(ObjectSuffix)
|
Objects0=$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IntermediateDirectory)/fmain.cpp$(ObjectSuffix) $(IntermediateDirectory)/fsettings.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_crossexport.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_crossgen.cpp$(ObjectSuffix) $(IntermediateDirectory)/fbgui_fbgui.cpp$(ObjectSuffix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -95,6 +95,38 @@ $(IntermediateDirectory)/main.cpp$(DependSuffix): main.cpp
|
|||||||
$(IntermediateDirectory)/main.cpp$(PreprocessSuffix): main.cpp
|
$(IntermediateDirectory)/main.cpp$(PreprocessSuffix): main.cpp
|
||||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/main.cpp$(PreprocessSuffix) "main.cpp"
|
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/main.cpp$(PreprocessSuffix) "main.cpp"
|
||||||
|
|
||||||
|
$(IntermediateDirectory)/fmain.cpp$(ObjectSuffix): fmain.cpp $(IntermediateDirectory)/fmain.cpp$(DependSuffix)
|
||||||
|
$(CXX) $(IncludePCH) $(SourceSwitch) "/data/Sync/SyncProjects/CrossGen/wxCrossGen/fmain.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/fmain.cpp$(ObjectSuffix) $(IncludePath)
|
||||||
|
$(IntermediateDirectory)/fmain.cpp$(DependSuffix): fmain.cpp
|
||||||
|
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/fmain.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/fmain.cpp$(DependSuffix) -MM "fmain.cpp"
|
||||||
|
|
||||||
|
$(IntermediateDirectory)/fmain.cpp$(PreprocessSuffix): fmain.cpp
|
||||||
|
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/fmain.cpp$(PreprocessSuffix) "fmain.cpp"
|
||||||
|
|
||||||
|
$(IntermediateDirectory)/fsettings.cpp$(ObjectSuffix): fsettings.cpp $(IntermediateDirectory)/fsettings.cpp$(DependSuffix)
|
||||||
|
$(CXX) $(IncludePCH) $(SourceSwitch) "/data/Sync/SyncProjects/CrossGen/wxCrossGen/fsettings.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/fsettings.cpp$(ObjectSuffix) $(IncludePath)
|
||||||
|
$(IntermediateDirectory)/fsettings.cpp$(DependSuffix): fsettings.cpp
|
||||||
|
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/fsettings.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/fsettings.cpp$(DependSuffix) -MM "fsettings.cpp"
|
||||||
|
|
||||||
|
$(IntermediateDirectory)/fsettings.cpp$(PreprocessSuffix): fsettings.cpp
|
||||||
|
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/fsettings.cpp$(PreprocessSuffix) "fsettings.cpp"
|
||||||
|
|
||||||
|
$(IntermediateDirectory)/src_crossexport.cpp$(ObjectSuffix): ../src/crossexport.cpp $(IntermediateDirectory)/src_crossexport.cpp$(DependSuffix)
|
||||||
|
$(CXX) $(IncludePCH) $(SourceSwitch) "/data/Sync/SyncProjects/CrossGen/src/crossexport.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_crossexport.cpp$(ObjectSuffix) $(IncludePath)
|
||||||
|
$(IntermediateDirectory)/src_crossexport.cpp$(DependSuffix): ../src/crossexport.cpp
|
||||||
|
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/src_crossexport.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/src_crossexport.cpp$(DependSuffix) -MM "../src/crossexport.cpp"
|
||||||
|
|
||||||
|
$(IntermediateDirectory)/src_crossexport.cpp$(PreprocessSuffix): ../src/crossexport.cpp
|
||||||
|
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/src_crossexport.cpp$(PreprocessSuffix) "../src/crossexport.cpp"
|
||||||
|
|
||||||
|
$(IntermediateDirectory)/src_crossgen.cpp$(ObjectSuffix): ../src/crossgen.cpp $(IntermediateDirectory)/src_crossgen.cpp$(DependSuffix)
|
||||||
|
$(CXX) $(IncludePCH) $(SourceSwitch) "/data/Sync/SyncProjects/CrossGen/src/crossgen.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_crossgen.cpp$(ObjectSuffix) $(IncludePath)
|
||||||
|
$(IntermediateDirectory)/src_crossgen.cpp$(DependSuffix): ../src/crossgen.cpp
|
||||||
|
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/src_crossgen.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/src_crossgen.cpp$(DependSuffix) -MM "../src/crossgen.cpp"
|
||||||
|
|
||||||
|
$(IntermediateDirectory)/src_crossgen.cpp$(PreprocessSuffix): ../src/crossgen.cpp
|
||||||
|
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/src_crossgen.cpp$(PreprocessSuffix) "../src/crossgen.cpp"
|
||||||
|
|
||||||
$(IntermediateDirectory)/fbgui_fbgui.cpp$(ObjectSuffix): fbgui/fbgui.cpp $(IntermediateDirectory)/fbgui_fbgui.cpp$(DependSuffix)
|
$(IntermediateDirectory)/fbgui_fbgui.cpp$(ObjectSuffix): fbgui/fbgui.cpp $(IntermediateDirectory)/fbgui_fbgui.cpp$(DependSuffix)
|
||||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/data/Sync/SyncProjects/CrossGen/wxCrossGen/fbgui/fbgui.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/fbgui_fbgui.cpp$(ObjectSuffix) $(IncludePath)
|
$(CXX) $(IncludePCH) $(SourceSwitch) "/data/Sync/SyncProjects/CrossGen/wxCrossGen/fbgui/fbgui.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/fbgui_fbgui.cpp$(ObjectSuffix) $(IncludePath)
|
||||||
$(IntermediateDirectory)/fbgui_fbgui.cpp$(DependSuffix): fbgui/fbgui.cpp
|
$(IntermediateDirectory)/fbgui_fbgui.cpp$(DependSuffix): fbgui/fbgui.cpp
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CodeLite_Project Name="wxCrossGen" InternalType="GUI">
|
<CodeLite_Project Name="wxCrossGen" InternalType="GUI">
|
||||||
<Plugins>
|
<Plugins>
|
||||||
|
<Plugin Name="CppCheck"/>
|
||||||
<Plugin Name="CMakePlugin">
|
<Plugin Name="CMakePlugin">
|
||||||
<![CDATA[[{
|
<![CDATA[[{
|
||||||
"name": "Debug",
|
"name": "Debug",
|
||||||
@@ -27,14 +28,18 @@
|
|||||||
<Dependencies/>
|
<Dependencies/>
|
||||||
<VirtualDirectory Name="src">
|
<VirtualDirectory Name="src">
|
||||||
<File Name="main.cpp"/>
|
<File Name="main.cpp"/>
|
||||||
<File Name="wxgui.hpp"/>
|
|
||||||
<File Name="fsettings.hpp"/>
|
<File Name="fsettings.hpp"/>
|
||||||
<File Name="settingsconsts.hpp"/>
|
<File Name="settingsconsts.hpp"/>
|
||||||
|
<File Name="fmain.hpp"/>
|
||||||
|
<File Name="fmain.cpp"/>
|
||||||
|
<File Name="fsettings.cpp"/>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
<VirtualDirectory Name="Shared">
|
<VirtualDirectory Name="Shared">
|
||||||
<File Name="../src/crossgen.hpp"/>
|
<File Name="../src/crossgen.hpp"/>
|
||||||
<File Name="../src/crossbasetypes.hpp"/>
|
<File Name="../src/crossbasetypes.hpp"/>
|
||||||
<File Name="../src/crossexport.hpp"/>
|
<File Name="../src/crossexport.hpp"/>
|
||||||
|
<File Name="../src/crossexport.cpp"/>
|
||||||
|
<File Name="../src/crossgen.cpp"/>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
<Settings Type="Executable">
|
<Settings Type="Executable">
|
||||||
<GlobalSettings>
|
<GlobalSettings>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
../Release/main.cpp.o ../Release/fbgui_fbgui.cpp.o
|
../Release/main.cpp.o ../Release/fmain.cpp.o ../Release/fsettings.cpp.o ../Release/src_crossexport.cpp.o ../Release/src_crossgen.cpp.o ../Release/fbgui_fbgui.cpp.o
|
||||||
|
|||||||
Reference in New Issue
Block a user